issue #144: ansible: use service.Pool with default size=1.

wip-fakessh-exit-status
David Wilson 7 years ago
parent fe900087a2
commit 19632473dc

@ -30,7 +30,6 @@ from __future__ import absolute_import
import os import os
import socket import socket
import sys import sys
import threading
import mitogen import mitogen
import mitogen.core import mitogen.core
@ -147,9 +146,9 @@ class MuxProcess(object):
Construct a ContextService and a thread to service requests for it Construct a ContextService and a thread to service requests for it
arriving from worker processes. arriving from worker processes.
""" """
self.service = ansible_mitogen.services.ContextService(self.router) self.pool = mitogen.service.Pool(self.router, [
self.service_thread = threading.Thread(target=self.service.run) ansible_mitogen.services.ContextService(self.router)
self.service_thread.start() ])
def on_broker_shutdown(self): def on_broker_shutdown(self):
""" """
@ -157,5 +156,5 @@ class MuxProcess(object):
the main thread) by unlinking the listening socket. Ideally this would the main thread) by unlinking the listening socket. Ideally this would
happen explicitly, but Ansible provides no hook to allow it. happen explicitly, but Ansible provides no hook to allow it.
""" """
self.pool.stop()
os.unlink(self.listener.path) os.unlink(self.listener.path)
self.service_thread.join(timeout=10)

Loading…
Cancel
Save