Use pickle for config objects (#12594)

This commit is contained in:
Nicolas Mowen 2024-07-24 09:37:29 -06:00 committed by GitHub
parent 6de426c697
commit 1bd3285679
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -21,7 +21,7 @@ class ConfigPublisher:
def publish(self, topic: str, payload: any) -> None: def publish(self, topic: str, payload: any) -> None:
"""There is no communication back to the processes.""" """There is no communication back to the processes."""
self.socket.send_string(topic, flags=zmq.SNDMORE) self.socket.send_string(topic, flags=zmq.SNDMORE)
self.socket.send_json(payload) self.socket.send_pyobj(payload)
def stop(self) -> None: def stop(self) -> None:
self.stop_event.set() self.stop_event.set()
@ -42,7 +42,7 @@ class ConfigSubscriber:
"""Returns updated config or None if no update.""" """Returns updated config or None if no update."""
try: try:
topic = self.socket.recv_string(flags=zmq.NOBLOCK) topic = self.socket.recv_string(flags=zmq.NOBLOCK)
return (topic, self.socket.recv_json()) return (topic, self.socket.recv_pyobj())
except zmq.ZMQError: except zmq.ZMQError:
return (None, None) return (None, None)