--- a/src/pyams_scheduler/include.py Wed Jun 17 09:59:00 2015 +0200
+++ b/src/pyams_scheduler/include.py Tue Jun 30 15:20:45 2015 +0200
@@ -28,6 +28,7 @@
from pyams_scheduler.process import SchedulerProcess, SchedulerMessageHandler
from pyams_utils.zodb import get_connection_from_settings
from pyams_zmq.process import process_exit_func
+from zmq.error import ZMQError
def include_package(config):
@@ -75,6 +76,10 @@
'registry': config.registry})
logger.debug("Starting tasks scheduler {0!r}".format(process))
# start process
- process.start()
- if process.is_alive():
- atexit.register(process_exit_func, process=process)
+ try:
+ process.start()
+ except ZMQError:
+ process.join()
+ else:
+ if process.is_alive():
+ atexit.register(process_exit_func, process=process)