trio icon indicating copy to clipboard operation
trio copied to clipboard

feature request: track max queue length in memory channel stats

Open belm0 opened this issue 5 years ago • 0 comments

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

belm0 avatar Sep 14 '20 01:09 belm0