diff --git a/flamenco_worker/worker.py b/flamenco_worker/worker.py index 9e65c6f699e338154b9b2e52f75b8c4b0170910c..65943fd3b354f1763a098224fd51f5a5acfc7e52 100644 --- a/flamenco_worker/worker.py +++ b/flamenco_worker/worker.py @@ -808,7 +808,7 @@ class FlamencoWorker: async def sleeping(self): """Regularly polls the Manager to see if we're allowed to wake up again.""" - while True: + while self.state != WorkerState.SHUTTING_DOWN and self.loop.is_running(): try: await asyncio.sleep(ASLEEP_POLL_STATUS_CHANGE_REQUESTED_DELAY) resp = await self.manager.get('/status-change', loop=self.loop)