Tasker::Reactor
Inherits Reference < Object
A single, process-wide timing reactor.
Historically every pending Tasker::Task owned its own fiber that simply
slept until the task was due. In a process running many schedules (and one
short-lived timeout timer per in-flight queued command) that is thousands of
sleeping fibers, each holding a fiber stack. Crystal's fiber stack pool grows
to the high-water mark of live fibers and never fully returns it, so a large
population of sleeping timer fibers permanently inflates RSS.
The reactor replaces those per-task fibers with a single scheduler fiber that owns an indexed binary min-heap keyed on each task's next fire time. Pending tasks cost a heap entry, not a fiber. When a task is due the reactor spawns a short-lived fiber to run its callback — isolation is preserved (a blocking callback cannot stall the scheduler or sibling tasks), but a fiber only exists while a callback is actually executing.
Constants
Constructors
Class methods
Instance methods
Register (or re-register) task to fire at its next_scheduled time.