Revision 41f2249e logic/dispatcher.py
b/logic/dispatcher.py | ||
---|---|---|
67 | 67 |
self.logger.info("Attempting to connect to %s", |
68 | 68 |
settings.RABBIT_HOST) |
69 | 69 |
try: |
70 |
conn = amqp.Connection( host=settings.RABBIT_HOST,
|
|
71 |
userid=settings.RABBIT_USERNAME, |
|
72 |
password=settings.RABBIT_PASSWORD, |
|
73 |
virtual_host=settings.RABBIT_VHOST) |
|
70 |
conn = amqp.Connection(host=settings.RABBIT_HOST, |
|
71 |
userid=settings.RABBIT_USERNAME,
|
|
72 |
password=settings.RABBIT_PASSWORD,
|
|
73 |
virtual_host=settings.RABBIT_VHOST)
|
|
74 | 74 |
except socket.error: |
75 | 75 |
time.sleep(1) |
76 | 76 |
pass |
... | ... | |
219 | 219 |
signal(SIGINT, _exit_handler) |
220 | 220 |
signal(SIGTERM, _exit_handler) |
221 | 221 |
child(sys.argv[1:], logger) |
222 |
time.sleep(5) |
|
223 | 222 |
sys.exit(0) |
224 | 223 |
else: |
225 | 224 |
pids = (os.getpid(), newpid) |
... | ... | |
231 | 230 |
signal(SIGINT, _parent_handler) |
232 | 231 |
signal(SIGTERM, _parent_handler) |
233 | 232 |
|
234 |
# Wait for the last child process to exit |
|
235 |
try: |
|
236 |
os.wait() |
|
237 |
except Exception : |
|
238 |
pass |
|
233 |
# Wait for all children process to die, one by one |
|
234 |
for c in children: |
|
235 |
try: |
|
236 |
os.wait() |
|
237 |
except Exception: |
|
238 |
pass |
|
239 | 239 |
|
240 | 240 |
|
241 | 241 |
if __name__ == "__main__": |
Also available in: Unified diff