From cf30e88a3e6157a5170a5d9306addcc5f91bc491 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Sun, 22 Apr 2018 03:35:35 +0100 Subject: [PATCH] ansible: implement missing FileService.on_shutdown() --- ansible_mitogen/services.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ansible_mitogen/services.py b/ansible_mitogen/services.py index de7f8135..e9f40130 100644 --- a/ansible_mitogen/services.py +++ b/ansible_mitogen/services.py @@ -381,6 +381,14 @@ class FileService(mitogen.service.Service): self._thread = threading.Thread(target=self._scheduler_main) self._thread.start() + def on_shutdown(self): + """ + Respond to shutdown of the service pool by marking our queue closed. + This causes :meth:`_sleep_on_queue` to wake immediately and return + :data:`False`, causing the scheduler thread main function to exit. + """ + self._queue.close() + def _pending_bytes(self, stream): """ Defer a function call to the Broker thread in order to accurately