Skip to content

Commit

Permalink
revert zmq changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mgor committed Nov 14, 2024
1 parent e588279 commit 987efba
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 15 deletions.
4 changes: 1 addition & 3 deletions grizzly/tasks/clients/messagequeue.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def __init__(

self.create_context()

self._zmq_context = zmq.Context.instance()
self._zmq_context = zmq.Context()
self._worker = {}
self.max_message_size = None

Expand Down Expand Up @@ -248,8 +248,6 @@ def create_client(self, parent: GrizzlyScenario) -> Generator[ztypes.Socket, Non
ztypes.Socket,
self._zmq_context.socket(zmq.REQ),
)
client.setsockopt(zmq.REQ_RELAXED, 1)
client.setsockopt(zmq.REQ_CORRELATE, 1)
client.setsockopt(zmq.LINGER, 0)
client.connect(self._zmq_url)

Expand Down
6 changes: 2 additions & 4 deletions grizzly/tasks/clients/servicebus.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def __init__( # noqa: PLR0915
self.context.update({'content_type': content_type})

self._state = {}
self._zmq_context = zmq.Context.instance()
self._zmq_context = zmq.Context()

def get_state(self, parent: GrizzlyScenario) -> State:
state = self._state.get(parent, None)
Expand All @@ -298,15 +298,13 @@ def get_state(self, parent: GrizzlyScenario) -> State:

# context might have been destroyed as all existing sockets has been closed
if self._zmq_context.closed:
self._zmq_context = zmq.Context.instance()
self._zmq_context = zmq.Context()

state = State(
parent=parent,
client=cast(ztypes.Socket, self._zmq_context.socket(zmq.REQ)),
context=context,
)
state.client.setsockopt(zmq.REQ_RELAXED, 1)
state.client.setsockopt(zmq.REQ_CORRELATE, 1)
state.client.setsockopt(zmq.LINGER, 0)
state.client.connect(self._zmq_url)
self._state.update({parent: state})
Expand Down
4 changes: 1 addition & 3 deletions grizzly/users/messagequeue.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class MessageQueueUser(GrizzlyUser):

am_context: AsyncMessageContext
worker_id: Optional[str]
zmq_context = zmq.Context.instance()
zmq_context = zmq.Context()
zmq_client: ztypes.Socket
zmq_url = 'tcp://127.0.0.1:5554'

Expand Down Expand Up @@ -281,8 +281,6 @@ def on_start(self) -> None:
'context': self.am_context,
}):
self.zmq_client = self.zmq_context.socket(zmq.REQ)
self.zmq_client.setsockopt(zmq.REQ_RELAXED, 1)
self.zmq_client.setsockopt(zmq.REQ_CORRELATE, 1)
self.zmq_client.setsockopt(zmq.LINGER, 0)
self.zmq_client.connect(self.zmq_url)
except Exception as e:
Expand Down
4 changes: 1 addition & 3 deletions grizzly/users/servicebus.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class ServiceBusUser(GrizzlyUser):

am_context: AsyncMessageContext
worker_id: Optional[str]
zmq_context = zmq.Context.instance()
zmq_context = zmq.Context()
zmq_client: ztypes.Socket
zmq_url = 'tcp://127.0.0.1:5554'
hellos: set[str]
Expand Down Expand Up @@ -193,8 +193,6 @@ def on_start(self) -> None:
super().on_start()

self.zmq_client = self.zmq_context.socket(zmq.REQ)
self.zmq_client.setsockopt(zmq.REQ_RELAXED, 1)
self.zmq_client.setsockopt(zmq.REQ_CORRELATE, 1)
self.zmq_client.setsockopt(zmq.LINGER, 0)
self.zmq_client.connect(self.zmq_url)

Expand Down
2 changes: 0 additions & 2 deletions grizzly_extras/async_message/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ def __init__(self, context: ztypes.Context, identity: str, event: Optional[Event
self.integration = None
self._event = Event() if event is None else event
self.socket = self.context.socket(zmq.REQ)
self.socket.setsockopt(zmq.REQ_RELAXED, 1)
self.socket.setsockopt(zmq.REQ_CORRELATE, 1)
self.socket.setsockopt_string(zmq.IDENTITY, self.identity)
self.socket.connect('inproc://workers')
self.socket.send_string(LRU_READY)
Expand Down

0 comments on commit 987efba

Please sign in to comment.