From e6314436eab33f9466bd8a44d1e305cf60a240e0 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Sat, 8 May 2021 07:23:17 +0300 Subject: [PATCH] Log job queue overflows --- src/jobs.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/jobs.rs b/src/jobs.rs index 56d411a8..d68bd161 100644 --- a/src/jobs.rs +++ b/src/jobs.rs @@ -24,7 +24,11 @@ struct Jobs { impl Jobs { fn start Output + Send + 'static>(&mut self, f: F) -> JobId { let (tx, rx) = mpsc::channel(); - self.pool.execute_to(tx, Thunk::of(|| f())); + if self.pool.queued_count() > self.pool.max_count() { + log::warn!("Job queue filling up (active {}, queued {})", self.pool.active_count(), self.pool.queued_count()); + } + + self.pool.execute_to(tx, Thunk::of(f)); let id = self.next_job.to_string(); self.next_job += 1; self.map.insert(id.clone(), Job { rx });