Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: only write out error counts on errors #560

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions event-svc/src/event/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,18 @@ impl<'a, S: BlockStore> Migrator<'a, S> {
tile_doc_count = self.tile_doc_count,
"migration finished"
);
// Write out model error counts
const CSV_FILE_PATH: &str = "model_error_counts.csv";
let mut model_csv = File::create(CSV_FILE_PATH).await?;
model_csv.write_all(b"model,count\n").await?;
for (model, count) in self.model_error_counts {
model_csv
.write_all(format!("{model},{count}\n").as_bytes())
.await?;
if !self.model_error_counts.is_empty() {
// Write out model error counts
const CSV_FILE_PATH: &str = "model_error_counts.csv";
let mut model_csv = File::create(CSV_FILE_PATH).await?;
model_csv.write_all(b"model,count\n").await?;
for (model, count) in self.model_error_counts {
model_csv
.write_all(format!("{model},{count}\n").as_bytes())
.await?;
}
info!(path = CSV_FILE_PATH, "wrote error counts by model");
}
info!(path = CSV_FILE_PATH, "wrote error counts by model");
Ok(())
}
// Decodes the block and if it is a Ceramic event, it and related blocks are constructed into an
Expand Down
Loading