Commit 19632473 authored by David Wilson's avatar David Wilson

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

parent fe900087
...@@ -30,7 +30,6 @@ from __future__ import absolute_import ...@@ -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): ...@@ -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): ...@@ -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)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment