diff options
author | Bert Belder <bertbelder@gmail.com> | 2019-09-20 00:09:43 +0200 |
---|---|---|
committer | Bert Belder <bertbelder@gmail.com> | 2019-09-20 19:00:12 +0200 |
commit | 93b7acf99d6456e6e194c03f024b788ce5adf20e (patch) | |
tree | f050f7ad64784e5df2cc62e14a2ae1736f304189 /cli | |
parent | 560edc536c67d55001e679e6179a8959e4ac727f (diff) |
js: reschedule global timer if it fires earlier than expected (#2989)
When the global timer fires earlier than expected, which apparently
happens sometimes on server editions of Windows, we didn't call any
setTimeout callbacks, but we *also* didn't reschedule the global timer
to fire again later.
When this situation occurred it would make deno exit abruptly if there
were no other asynchronous ops running on the event loop. It could also
lead to application hangs if the upcoming setTimeout callback was
critical for the application to make progress.
Diffstat (limited to 'cli')
-rw-r--r-- | cli/ops/timers.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/cli/ops/timers.rs b/cli/ops/timers.rs index 46217a188..abcd5c1b3 100644 --- a/cli/ops/timers.rs +++ b/cli/ops/timers.rs @@ -33,7 +33,7 @@ pub fn op_global_timer( let state = state; let mut t = state.global_timer.lock().unwrap(); - let deadline = Instant::now() + Duration::from_millis(val as u64); + let deadline = Instant::now() + Duration::from_millis(val); let f = t .new_timeout(deadline) .then(move |_| futures::future::ok(json!({}))); |