From 18b0be65e2e6bbd2afa8bc6e098937e959ceed71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= <sybren@stuvel.eu> Date: Mon, 14 Jan 2019 11:30:39 +0100 Subject: [PATCH] Added shutdown check to sleep state to prevent infinite loops --- flamenco_worker/worker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flamenco_worker/worker.py b/flamenco_worker/worker.py index 9e65c6f6..65943fd3 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) -- GitLab