Skip to content

Commit

Permalink
Avoid crashing threadpool threads on exception
Browse files Browse the repository at this point in the history
A crashed scheduler thread would prevent any future scheduled jobs to run
  • Loading branch information
unode authored Oct 14, 2021
1 parent 2c8d8c3 commit 17301d3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mmpy_bot/threadpool.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ def handle_work(self):
function, arguments = self._queue.get()
# Notify the pool that we started working
self._busy_workers.put(1)
function(*arguments)
try:
function(*arguments)
except Exception:
log.exception()
# Notify the pool that we finished working
self._queue.task_done()
self._busy_workers.get()
Expand Down

0 comments on commit 17301d3

Please sign in to comment.