From cd60e1cabc1ea1c2276a4c19880304629cd6b6c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= <sybren@stuvel.eu> Date: Fri, 20 Oct 2017 14:41:47 +0200 Subject: [PATCH] Don't acknowledge 'shutdown' state. --- flamenco_worker/worker.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/flamenco_worker/worker.py b/flamenco_worker/worker.py index 25baa536..2da839da 100644 --- a/flamenco_worker/worker.py +++ b/flamenco_worker/worker.py @@ -631,13 +631,11 @@ class FlamencoWorker: self._log.info('Shutting down by request of the Flamenco Manager') self.state = WorkerState.SHUTTING_DOWN - # Ack the status change before doing the actual shutdown. - def stop_main_loop(*args): - self._log.debug('Stopping main loop (%r)', args) - self.loop.stop() - - post_task = self.ack_status_change('shutdown') - post_task.add_done_callback(stop_main_loop) + # Don't bother acknowledging this status, as we'll push an "offline" status anyway. + # This also makes sure that when we're asleep and told to shut down, the Manager + # sees an asleep → offline status change, and can remember that we should go back + # to asleep status when we come back online. + self.loop.stop() def stop_sleeping(self): """Stops the asyncio task for sleeping.""" -- GitLab