Closed mcginty closed 3 years ago
Would this mean something more involved than thread::sleep()
? Perhaps interruptible sleep, perhaps by the control channel/shutdown? (the interruptible sleep sounds a bit like async runtime though)
I think it mostly means being able to run actors at a repeated interval (to rephrase, send them messages at a fixed interval), or send a message after a specified timeout without blocking any threads. Async runtimes would definitely be helpful here.
Async runtimes basically just run a separate timer thread that usually uses the Timing Wheels architecture.
See: https://docs.rs/tokio-timer/0.2.13/tokio_timer/timer/struct.Timer.html
I guess it would be a matter of us deciding if we wanted to (possibly behind a feature flag) implement or import a timer thread that could send messages at delays or intervals.
Some resources that will be helpful here:
https://github.com/tokio-rs/tokio/tree/master/tokio-util/src/time
A simple, naive implementation has been implemented in #52 but I'd like to eventually replace that implementation with #53 after settling on a user-facing API.
Do we want??