diff --git a/crates/index-scheduler/src/scheduler/mod.rs b/crates/index-scheduler/src/scheduler/mod.rs index 90c9584f7..9268bf3e7 100644 --- a/crates/index-scheduler/src/scheduler/mod.rs +++ b/crates/index-scheduler/src/scheduler/mod.rs @@ -166,16 +166,31 @@ impl IndexScheduler { let processing_batch = &mut processing_batch; let progress = progress.clone(); std::thread::scope(|s| { + let p = progress.clone(); let handle = std::thread::Builder::new() .name(String::from("batch-operation")) .spawn_scoped(s, move || { - cloned_index_scheduler.process_batch(batch, processing_batch, progress) + cloned_index_scheduler.process_batch(batch, processing_batch, p) }) .unwrap(); match handle.join() { - Ok(ret) => ret, + Ok(ret) => { + if ret.is_err() { + if let Ok(progress_view) = + serde_json::to_string(&progress.as_progress_view()) + { + tracing::warn!("Batch failed while doing: {progress_view}") + } + } + ret + } Err(panic) => { + if let Ok(progress_view) = + serde_json::to_string(&progress.as_progress_view()) + { + tracing::warn!("Batch failed while doing: {progress_view}") + } let msg = match panic.downcast_ref::<&'static str>() { Some(s) => *s, None => match panic.downcast_ref::() {