fix a race condition in responses handling (some responses could be lost).
This commit is contained in:
parent
3f49908d86
commit
6013bb1247
1 changed files with 2 additions and 2 deletions
|
|
@ -131,7 +131,7 @@ class BackendsCall(object):
|
||||||
|
|
||||||
def _callback_thread_run(self, callback, errback):
|
def _callback_thread_run(self, callback, errback):
|
||||||
responses = []
|
responses = []
|
||||||
while not self.finish_event.isSet():
|
while not self.finish_event.isSet() or self.response_event.isSet():
|
||||||
self.response_event.wait()
|
self.response_event.wait()
|
||||||
with self.mutex:
|
with self.mutex:
|
||||||
responses = self.responses
|
responses = self.responses
|
||||||
|
|
@ -171,7 +171,7 @@ class BackendsCall(object):
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
# Don't know how to factorize with _callback_thread_run
|
# Don't know how to factorize with _callback_thread_run
|
||||||
responses = []
|
responses = []
|
||||||
while not self.finish_event.isSet():
|
while not self.finish_event.isSet() or self.response_event.isSet():
|
||||||
self.response_event.wait()
|
self.response_event.wait()
|
||||||
with self.mutex:
|
with self.mutex:
|
||||||
responses = self.responses
|
responses = self.responses
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue