skip wirting index is it already exists
This commit is contained in:
parent
e3e84be133
commit
8902f6ca6f
1 changed files with 6 additions and 0 deletions
|
|
@ -3,6 +3,7 @@
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use camino::Utf8PathBuf;
|
use camino::Utf8PathBuf;
|
||||||
use parquet::arrow::AsyncArrowWriter;
|
use parquet::arrow::AsyncArrowWriter;
|
||||||
|
use tracing::debug;
|
||||||
|
|
||||||
use crate::{directories::data_cache_directory, malie::models::Index};
|
use crate::{directories::data_cache_directory, malie::models::Index};
|
||||||
|
|
||||||
|
|
@ -18,6 +19,11 @@ impl Store {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn write_index(&self, index: Index) -> Result<()> {
|
pub async fn write_index(&self, index: Index) -> Result<()> {
|
||||||
|
let path = self.data_cache_directory.join("ptcgl_index.parquet");
|
||||||
|
if let Ok(true) = tokio::fs::try_exists(&path).await {
|
||||||
|
debug!("File {path} already exists, skipping.");
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
// let mut writer = AsyncArrowWriter::try_new(writer, arrow_schema, props)
|
// let mut writer = AsyncArrowWriter::try_new(writer, arrow_schema, props)
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue