Return an error instead of panicking on shutdown (#5530)
This commit is contained in:
parent
e380676937
commit
c5e6adc87a
|
|
@ -240,8 +240,16 @@ where
|
||||||
{
|
{
|
||||||
match Pin::new(worker_handle).poll(cx) {
|
match Pin::new(worker_handle).poll(cx) {
|
||||||
Poll::Ready(Ok(())) => return Poll::Ready(Err(self.get_worker_error())),
|
Poll::Ready(Ok(())) => return Poll::Ready(Err(self.get_worker_error())),
|
||||||
Poll::Ready(task_panic) => {
|
Poll::Ready(Err(task_cancelled)) if task_cancelled.is_cancelled() => {
|
||||||
task_panic.expect("unexpected panic in batch worker task")
|
tracing::warn!(
|
||||||
|
"batch task cancelled: {task_cancelled}\n\
|
||||||
|
Is Zebra shutting down?"
|
||||||
|
);
|
||||||
|
|
||||||
|
return Poll::Ready(Err(task_cancelled.into()));
|
||||||
|
}
|
||||||
|
Poll::Ready(Err(task_panic)) => {
|
||||||
|
std::panic::resume_unwind(task_panic.into_panic());
|
||||||
}
|
}
|
||||||
Poll::Pending => {}
|
Poll::Pending => {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue