fix: adjusted ping data on ping_stream, and made it so that communication agent is more robust and quick in ping communication.
ref: N25B-142
This commit is contained in:
@@ -45,7 +45,7 @@ async def ping_stream(request: Request):
|
||||
sub_socket = context.socket(zmq.SUB)
|
||||
sub_socket.connect(settings.zmq_settings.internal_comm_address)
|
||||
sub_socket.setsockopt(zmq.SUBSCRIBE, b"ping")
|
||||
connected = True
|
||||
connected = False
|
||||
|
||||
ping_frequency = 1 # How many seconds between ping attempts
|
||||
|
||||
@@ -68,7 +68,8 @@ async def ping_stream(request: Request):
|
||||
|
||||
|
||||
logger.debug(f"Yielded new connection event in robot ping router: {str(connected)}")
|
||||
yield f"data: {str(connected)}, time:{str(datetime.datetime.now().strftime("%H:%M:%S"))}\n\n"
|
||||
falseJson = json.dumps(connected)
|
||||
yield (f"data: {falseJson}\n\n")
|
||||
|
||||
|
||||
return StreamingResponse(event_stream(), media_type="text/event-stream")
|
||||
Reference in New Issue
Block a user