Skip to content

Commit

Permalink
unanswered_request_count: floor at zero
Browse files Browse the repository at this point in the history
  • Loading branch information
Neil Booth committed Apr 14, 2019
1 parent 1129c26 commit 4426e7b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion aiorpcx/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,8 @@ def recalc_concurrency(self):

def unanswered_request_count(self):
'''The number of requests received but not yet answered.'''
return len(self._group._pending) - 1
# Max with zero in case the message processing task hasn't yet spawned
return max(0, len(self._group._pending) - 1)

def extra_cost(self):
'''A dynamic value added to this session's cost when deciding how much to throttle
Expand Down

0 comments on commit 4426e7b

Please sign in to comment.