fix race condition: take the rtxn before entering the thread so we're sure we won't try to retrieve deleted tasks

This commit is contained in:
Tamo
2025-08-05 16:47:35 +02:00
parent 2b5b41790e
commit 3f1e172c6f
2 changed files with 40 additions and 36 deletions

View File

@ -446,16 +446,7 @@ impl IndexScheduler {
Ok(())
})?;
// We shouldn't crash the tick function if we can't send data to the webhooks
let webhooks = self.webhooks();
if !webhooks.webhooks.is_empty() {
let cloned_index_scheduler = self.private_clone();
std::thread::spawn(move || {
if let Err(e) = cloned_index_scheduler.notify_webhooks(webhooks, &ids) {
tracing::error!("Failure to notify webhooks: {e}");
}
});
}
self.notify_webhooks(ids);
#[cfg(test)]
self.breakpoint(crate::test_utils::Breakpoint::AfterProcessing);