From 8902f6ca6f85f2d68ae54584ced200df2294a897 Mon Sep 17 00:00:00 2001 From: Felipe Contreras Salinas Date: Mon, 29 Dec 2025 15:51:36 -0300 Subject: [PATCH] skip wirting index is it already exists --- src/data_store/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/data_store/mod.rs b/src/data_store/mod.rs index 940187b..04491b1 100644 --- a/src/data_store/mod.rs +++ b/src/data_store/mod.rs @@ -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(()) }