summaryrefslogtreecommitdiff
path: root/cli/global_timer.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2019-11-22 18:46:57 +0100
committerRy Dahl <ry@tinyclouds.org>2019-11-22 12:46:57 -0500
commitc6bb3d5a10ba8acceadcaa66050abcaefb7bc0bb (patch)
treee60f007215fc0f146db4457db85eda8f4716d314 /cli/global_timer.rs
parent363b968bfcef26c30f84e485beec6194e5b1dd98 (diff)
remove tokio_util::block_on (#3388)
This PR removes tokio_util::block_on - refactored compiler and file fetcher slightly so that we can safely block there - that's because only blocking path consist of only synchronous operations. Additionally I removed excessive use of tokio_util::panic_on_error and tokio_util::run_in_task and moved both functions to cli/worker.rs, to tests module. Closes #2960
Diffstat (limited to 'cli/global_timer.rs')
-rw-r--r--cli/global_timer.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/cli/global_timer.rs b/cli/global_timer.rs
index 9ab760ab4..e06cabc48 100644
--- a/cli/global_timer.rs
+++ b/cli/global_timer.rs
@@ -8,7 +8,7 @@
//! only need to be able to start and cancel a single timer (or Delay, as Tokio
//! calls it) for an entire Isolate. This is what is implemented here.
-use crate::tokio_util::panic_on_error;
+use crate::futures::TryFutureExt;
use futures::channel::oneshot;
use futures::future::FutureExt;
use std::future::Future;
@@ -43,9 +43,10 @@ impl GlobalTimer {
let (tx, rx) = oneshot::channel();
self.tx = Some(tx);
- let delay =
- panic_on_error(futures::compat::Compat01As03::new(Delay::new(deadline)));
- let rx = panic_on_error(rx);
+ let delay = futures::compat::Compat01As03::new(Delay::new(deadline))
+ .map_err(|err| panic!("Unexpected error in timeout {:?}", err));
+ let rx = rx
+ .map_err(|err| panic!("Unexpected error in receiving channel {:?}", err));
futures::future::select(delay, rx).then(|_| futures::future::ok(()))
}