Skip to content

Commit

Permalink
worker: fix deadlock when the LoggingThread is not running
Browse files Browse the repository at this point in the history
Resolves: #260
  • Loading branch information
lzaoral committed May 2, 2024
1 parent d4b1c22 commit 66caaab
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions kobo/worker/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ def run(self):

def write(self, data):
"""Add data to the queue and set the event for sending queue content."""
# Discard the data if the thread is not running to prevent deadlock
# when the queue is full.
if not self.is_alive():
return

if threading.get_ident() != self.ident:
self._queue.put(data)
self._event.set()
Expand Down

0 comments on commit 66caaab

Please sign in to comment.