Don't fail if zmq is busy

This commit is contained in:
Nicolas Mowen 2024-10-11 10:30:26 -06:00
parent 1215b598d5
commit f68be070ff
2 changed files with 10 additions and 6 deletions

View File

@ -142,6 +142,7 @@ class Dispatcher:
)
def handle_update_model_state():
if payload:
model = payload["model"]
state = payload["state"]
self.model_state[model] = ModelStatusTypesEnum[state]

View File

@ -65,8 +65,11 @@ class InterProcessRequestor:
def send_data(self, topic: str, data: any) -> any:
"""Sends data and then waits for reply."""
try:
self.socket.send_json((topic, data))
return self.socket.recv_json()
except zmq.ZMQError:
return ""
def stop(self) -> None:
self.socket.close()