Slightly more optimal not to check if we're done until we actually might be.

pull/1741/head
jMyles 2020-08-31 14:02:42 -07:00
parent 670ac3b122
commit a8da514981
1 changed files with 3 additions and 2 deletions

View File

@ -244,13 +244,14 @@ class NodeEngagementMutex:
self.completed[node] = response
else:
assert False # TODO: What happens if this is a 300 or 400 level response? (A 500 response will propagate as an error and be handled in the errback chain.)
if not self.nodes_contacted_during_partial_block:
if self.nodes_contacted_during_partial_block:
self._consider_finalizing()
else:
if len(self.completed) >= self._block_until_this_many_are_complete:
contacted = tuple(self.completed.keys())
self.nodes_contacted_during_partial_block = contacted
self.log.debug(f"Blocked for a little while, completed {contacted} nodes")
self._partial_queue.put(contacted)
self._consider_finalizing()
return response
def _handle_error(self, failure, node):