def close(self):
'''call close to send all in-flight requests and shut down the
senders nicely. Times out after max 20 seconds per sending thread
plus 10 seconds for the response queue'''
for i in range(self.max_concurrent_batches):
try:
self.pending.put(None, True, 10)
except queue.Full:
pass
for t in self.threads:
t.join(10)
# signal to the responses queue that nothing more is coming.
try:
self.responses.put(None, True, 10)
except queue.Full:
pass
评论列表
文章目录