mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-24 04:21:06 +00:00
Make spawn_essential_task more strict (#4198)
This commit is contained in:
committed by
Bastian Köcher
parent
d7b9dd300b
commit
d8ca2f37df
@@ -240,10 +240,13 @@ where
|
|||||||
|
|
||||||
fn spawn_essential_task(&self, task: impl Future<Item = (), Error = ()> + Send + 'static) {
|
fn spawn_essential_task(&self, task: impl Future<Item = (), Error = ()> + Send + 'static) {
|
||||||
let essential_failed = self.essential_failed.clone();
|
let essential_failed = self.essential_failed.clone();
|
||||||
let essential_task = task.map_err(move |_| {
|
let essential_task = std::panic::AssertUnwindSafe(task)
|
||||||
error!("Essential task failed. Shutting down service.");
|
.catch_unwind()
|
||||||
essential_failed.store(true, Ordering::Relaxed);
|
.then(move |_| {
|
||||||
});
|
error!("Essential task failed. Shutting down service.");
|
||||||
|
essential_failed.store(true, Ordering::Relaxed);
|
||||||
|
Ok(())
|
||||||
|
});
|
||||||
let task = essential_task.select(self.on_exit()).then(|_| Ok(()));
|
let task = essential_task.select(self.on_exit()).then(|_| Ok(()));
|
||||||
|
|
||||||
let _ = self.to_spawn_tx.unbounded_send(Box::new(task));
|
let _ = self.to_spawn_tx.unbounded_send(Box::new(task));
|
||||||
|
|||||||
Reference in New Issue
Block a user