[IMP] core: avoid to process work when worker is 'killed' during sleep.

If a signal is received during the worker _runloop sleep,
the worker will be marked as alive=False but process_work
will still be called once.

This commit prevents that by checking the worker state before
calling process_work.

closes odoo/odoo#31885

Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
This commit is contained in:
XavierDo
2019-03-19 09:43:10 +00:00
committed by Xavier-Do
parent 84df9948ed
commit a4049296d9
+2
View File
@@ -763,6 +763,8 @@ class Worker(object):
while self.alive:
self.multi.pipe_ping(self.watchdog_pipe)
self.sleep()
if not self.alive:
break
self.process_work()
self.check_limits()
except: