This should in theory result in increased burstiness since we remove
the plain trio.sleep() and instead always wait on the receive channel
as much as possible until the trio.move_on_after() (+ time diffing
calcs) times out and signals the next throttled send cycle. This also is
slightly easier to grok code-wise instead of the try, except and
another tight while loop until a trio.WouldBlock. The only simpler
way i can think to do it is with 2 tasks: 1 to collect ticks and the
other to read and send at the throttle rate.
This should in theory result in increased burstiness since we remove the plain
trio.sleep()
and instead always wait on the receive channel as much as possible until thetrio.move_on_after()
(+ time diffing calcs) times out and signals the next throttled send cycle. This also is slightly easier to grok code-wise instead of thetry, except
and another tight while loop until atrio.WouldBlock
. The only simpler way i can think to do it is with 2 tasks: 1 to collect ticks and the other to read and send at the throttle rate.