skip wirting index is it already exists

This commit is contained in:
Felipe 2025-12-29 15:51:36 -03:00
parent e3e84be133
commit 8902f6ca6f
Signed by: pitbuster
SSH key fingerprint: SHA256:HDYu2Pm4/TmSX8GBwV49UvFWr1Ljg8XlHxKeCpjJpOk

View file

@ -3,6 +3,7 @@
use anyhow::Result;
use camino::Utf8PathBuf;
use parquet::arrow::AsyncArrowWriter;
use tracing::debug;
use crate::{directories::data_cache_directory, malie::models::Index};
@ -18,6 +19,11 @@ impl Store {
}
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)
Ok(())
}