Warn about working closing on drop
This commit is contained in:
parent
1266873f5d
commit
5cd6a1b102
|
@ -42,6 +42,14 @@ impl Worker for LocalWorkerHandle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct WarnOnDrop(Uuid);
|
||||||
|
|
||||||
|
impl Drop for WarnOnDrop {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
warn!("Worker {} closing", self.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) fn local_worker<State>(
|
pub(crate) fn local_worker<State>(
|
||||||
queue: String,
|
queue: String,
|
||||||
processors: CachedProcessorMap<State>,
|
processors: CachedProcessorMap<State>,
|
||||||
|
@ -56,6 +64,7 @@ pub(crate) fn local_worker<State>(
|
||||||
let handle = LocalWorkerHandle { tx, id, queue };
|
let handle = LocalWorkerHandle { tx, id, queue };
|
||||||
|
|
||||||
spawn(async move {
|
spawn(async move {
|
||||||
|
let warn_on_drop = WarnOnDrop(id);
|
||||||
debug!("Beginning worker loop for {}", id);
|
debug!("Beginning worker loop for {}", id);
|
||||||
if let Err(e) = server.request_job(Box::new(handle.clone())).await {
|
if let Err(e) = server.request_job(Box::new(handle.clone())).await {
|
||||||
error!("Couldn't request first job, bailing, {}", e);
|
error!("Couldn't request first job, bailing, {}", e);
|
||||||
|
@ -72,6 +81,6 @@ pub(crate) fn local_worker<State>(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
warn!("Worker {} closing", id);
|
drop(warn_on_drop);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue