PubSub: correctly decrement the byte counter in drop() #4516
Labels
api: pubsub
Issues related to the Pub/Sub API.
priority: p2
Moderately-important priority. Fix may not be included in next release.
I'm looking at this 2 files:
Should the code in
base.py
line 215 bemax
instead ofmin
?Current code:
self._bytes = 50
self._bytes -= 20
self._bytes == 30
self._bytes = min([30, 0])
->self._bytes = 0
Should be:
self._bytes = 50
self._bytes -= 20
self._bytes == 30
self._bytes = max([30, 0])
->self._bytes = 30
even if we drop it below 0, we should use
max
:self._bytes = 10
self._bytes -= 20
self._bytes == -10
min([-10, 0]) == -10
should bemax([-10, 0]) == 0
Or is there something I miss?
The text was updated successfully, but these errors were encountered: