Skip to content
This repository has been archived by the owner on Apr 2, 2018. It is now read-only.

Timers don't always fire if the tick duration isn't a multiple of 1ms #14

Open
thomaswhiteway opened this issue Mar 11, 2017 · 1 comment

Comments

@thomaswhiteway
Copy link

For example, the following code may or may not terminate.

let timer = wheel()
    .tick_duration(Duration::new(0, 100_000))
    .build();
timer.sleep(Duration::from_millis(10)).wait().unwrap();

I suspect the problem is that the tick duration is rounded up to the next full ms for the wheel, but not for the tolerance, so the worker can unpark the task for the timer before it's ready to fire.

The solution may just be to disallow invalid tick durations.

@carllerche
Copy link
Member

Good catch, definitely a bug.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants