From 782352ed234d4e5de498b57c1951f70c3c7e9c88 Mon Sep 17 00:00:00 2001 From: Andre Merzky Date: Tue, 3 Dec 2024 08:58:09 +0100 Subject: [PATCH] zmq startup is faster than we think --- src/radical/utils/zmq/pubsub.py | 8 ++++---- src/radical/utils/zmq/queue.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/radical/utils/zmq/pubsub.py b/src/radical/utils/zmq/pubsub.py index 606a935f..9faf0157 100644 --- a/src/radical/utils/zmq/pubsub.py +++ b/src/radical/utils/zmq/pubsub.py @@ -111,7 +111,7 @@ def _bridge_initialize(self): self._log.info(' sub on %s: %s', self._uid, self._addr_sub) # make sure bind is active - time.sleep(0.1) + time.sleep(0.01) # start polling for messages self._poll = zmq.Poller() @@ -202,7 +202,7 @@ def __init__(self, channel, url=None, log=None, prof=None, path=None): self._socket.hwm = _HIGH_WATER_MARK self._socket.connect(self._url) - time.sleep(0.1) + time.sleep(0.01) # -------------------------------------------------------------------------- @@ -364,7 +364,7 @@ def __init__(self, channel, url=None, topic=None, cb=None, self._sock.hwm = _HIGH_WATER_MARK self._sock.connect(self._url) - time.sleep(0.1) + time.sleep(0.01) # only allow `get()` and `get_nowait()` self._interactive = True @@ -577,7 +577,7 @@ def work_pub(uid, n, delay): t_a.join() t_b.join() - time.sleep(0.1) + time.sleep(0.01) assert data['A']['A'] == c_a assert data['B']['B'] == c_b diff --git a/src/radical/utils/zmq/queue.py b/src/radical/utils/zmq/queue.py index c519050c..d255f8f0 100644 --- a/src/radical/utils/zmq/queue.py +++ b/src/radical/utils/zmq/queue.py @@ -285,7 +285,7 @@ def _bridge_work(self): # We don't want to use poll timouts since we use two # competing polls and don't want the idle channel slow down # the busy one. - time.sleep(0.1) + time.sleep(0.01) except Exception: self._log.exception('bridge failed') @@ -438,7 +438,7 @@ def _listener(url, qname=None, uid=None): qname = 'default' assert url in Getter._callbacks - time.sleep(0.1) + time.sleep(0.01) try: term = Getter._callbacks.get(url, {}).get('term') @@ -780,7 +780,7 @@ def work_pub(uid, n, delay): t_a.join() t_b.join() - time.sleep(0.1) + time.sleep(0.01) import pprint pprint.pprint(data)