trio
trio copied to clipboard
feature request: track max queue length in memory channel stats
use case: if you need queueing but inf is not reasonable, to find a reasonable limit you'll want stats on the max observed queuing for actual run sessions of the app
doesn't seem like too much overhead to always collect it
if self._state.receive_tasks:
...
else:
n = len(self._state.data)
if n < self._state.max_buffer_size:
self._state.data.append(value)
self._state._max_observed_size = max(n + 1, self._state._max_observed_size)
else:
raise trio.WouldBlock