Skip to content
This repository was archived by the owner on Apr 2, 2018. It is now read-only.
This repository was 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

Description

@thomaswhiteway

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions