mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Catch a possible error on shutdown
Catches a condition where our exception handler might itself raise an exception on shutdown.
This commit is contained in:
parent
64e881e634
commit
2083eee7f7
@ -223,9 +223,15 @@ class ThreadPool(object):
|
||||
while True:
|
||||
# 1s timeout so that if the parent dies this thread will die within 1s
|
||||
try:
|
||||
func, args, kwargs = self._job_queue.get(timeout=1)
|
||||
self._job_queue.task_done() # Mark the task as done once we get it
|
||||
except queue.Empty:
|
||||
try:
|
||||
func, args, kwargs = self._job_queue.get(timeout=1)
|
||||
self._job_queue.task_done() # Mark the task as done once we get it
|
||||
except queue.Empty:
|
||||
continue
|
||||
except AttributeError:
|
||||
# During shutdown, `queue` may not have an `Empty` atttribute. Thusly,
|
||||
# we have to catch a possible exception from our exception handler in
|
||||
# order to avoid an unclean shutdown. Le sigh.
|
||||
continue
|
||||
try:
|
||||
log.debug('ThreadPool executing func: {0} with args:{1}'
|
||||
|
Loading…
Reference in New Issue
Block a user