fix(events): Resource events now run on incremental syncs, fix output and progress bar
Three bugs fixed: 1. Early return in orchestrator when no discussions needed sync also skipped resource event enqueue+drain. On incremental syncs (the most common case), resource events were never fetched. Restructured to use if/else instead of early return so Step 4 always executes. 2. Ingest command JSON and human-readable output silently dropped resource_events_fetched/failed counts. Added to IngestJsonData and print_ingest_summary. 3. Progress bar reuse after finish_and_clear caused indicatif to silently ignore subsequent set_position/set_length calls. Added reset() call before reconfiguring the bar for resource events. Also removed stale comment referencing "unsafe" that didn't reflect the actual unchecked_transaction approach. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -253,8 +253,8 @@ pub async fn run_ingest(
|
||||
disc_bar_clone.finish_and_clear();
|
||||
}
|
||||
ProgressEvent::ResourceEventsFetchStarted { total } => {
|
||||
disc_bar_clone.reset();
|
||||
disc_bar_clone.set_length(total as u64);
|
||||
disc_bar_clone.set_position(0);
|
||||
disc_bar_clone.set_style(
|
||||
ProgressStyle::default_bar()
|
||||
.template(" {spinner:.blue} Fetching resource events [{bar:30.cyan/dim}] {pos}/{len}")
|
||||
@@ -495,6 +495,8 @@ struct IngestJsonData {
|
||||
labels_created: usize,
|
||||
discussions_fetched: usize,
|
||||
notes_upserted: usize,
|
||||
resource_events_fetched: usize,
|
||||
resource_events_failed: usize,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
@@ -553,6 +555,8 @@ pub fn print_ingest_summary_json(result: &IngestResult) {
|
||||
labels_created: result.labels_created,
|
||||
discussions_fetched: result.discussions_fetched,
|
||||
notes_upserted: result.notes_upserted,
|
||||
resource_events_fetched: result.resource_events_fetched,
|
||||
resource_events_failed: result.resource_events_failed,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -613,4 +617,16 @@ pub fn print_ingest_summary(result: &IngestResult) {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if result.resource_events_fetched > 0 || result.resource_events_failed > 0 {
|
||||
println!(
|
||||
" Resource events: {} fetched{}",
|
||||
result.resource_events_fetched,
|
||||
if result.resource_events_failed > 0 {
|
||||
format!(", {} failed", result.resource_events_failed)
|
||||
} else {
|
||||
String::new()
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user