pub(crate) const MAX_WAIT_CHUNK: Duration;Expand description
Longest a RateLimitedStream sleeps before re-reading its controller.
The wait for one item used to be computed once, when the item was read, and then slept out whole. That is invisible at the rates this adapter was written for and wrong at the rates the PIX filler uses it at: a stream idling at one packet a minute that is raised to ten a second would apply the new rate up to a minute later, which is a minute of a funded cycle’s deadline spent honouring a decision that has been superseded.
Chunking the sleep bounds that lag by this value instead of by the period. Half a second is chosen against what the lag costs rather than against precision: it is short enough that a rate change is acted on within one sampling interval of the planner that made it, and long enough that a stream parked at the heartbeat wakes twice a second rather than continuously. The emitted rate is unaffected either way — the target instant is recomputed from when the item was read, so chunking changes when the controller is consulted, not when the item goes out.
pub(crate) because it is also the slack the Exit’s keep-alive control classifies a SURB-level
notification by: the stream releases a packet up to one chunk late, and a notification that has
merely been rescheduled is still the notification. Exported rather than duplicated so the two
cannot drift apart.