Skip to content

Commit

Permalink
Fixed dead lock in telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
lazarevevgeny committed Mar 18, 2021
1 parent 58012dc commit a330e91
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion model-optimizer/telemetry/utils/sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,16 @@ def _future_callback(future):
with self._lock:
self.queue_size -= 1

callback_needed = False
with self._lock:
if self.queue_size < MAX_QUEUE_SIZE:
fut = self.executor.submit(backend.send, message)
fut.add_done_callback(_future_callback)
callback_needed = True
self.queue_size += 1
else:
pass # dropping a message because the queue is full
if callback_needed:
fut.add_done_callback(_future_callback)

def force_shutdown(self, timeout: float):
"""
Expand Down

0 comments on commit a330e91

Please sign in to comment.