Added shutdown check to sleep state to prevent infinite loops

This commit is contained in:
2019-01-14 11:30:39 +01:00
parent 9a35b47e01
commit 18b0be65e2

View File

@@ -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)