SSE server reliability improvements

This commit is contained in:
Ian Renton
2026-06-05 16:11:25 +01:00
parent a2dff07c0e
commit 74caae342b
11 changed files with 26 additions and 26 deletions

View File

@@ -99,7 +99,7 @@ class APIAlertsStreamHandler(tornado_eventsource.handler.EventSourceHandler):
self._heartbeat.start()
# Flush headers immediately so nginx doesn't time out waiting for a response
self.write_message(msg="", event="keepalive")
self.write_message("keepalive", "")
except Exception as e:
logging.warning("Exception when serving SSE socket", e)
@@ -137,7 +137,7 @@ class APIAlertsStreamHandler(tornado_eventsource.handler.EventSourceHandler):
else:
# Send a keepalive comment if the queue was empty
self.write_message(msg="", event="keepalive")
self.write_message("keepalive", "")
if self._alert_queue not in self._sse_alert_queues:
logging.error("Web server cleared up a queue of an active connection!")

View File

@@ -101,7 +101,7 @@ class APISpotsStreamHandler(tornado_eventsource.handler.EventSourceHandler):
self._heartbeat.start()
# Flush headers immediately so nginx doesn't time out waiting for a response
self.write_message(msg="", event="keepalive")
self.write_message("keepalive", "")
except Exception as e:
logging.warning("Exception when serving SSE socket", e)
@@ -139,7 +139,7 @@ class APISpotsStreamHandler(tornado_eventsource.handler.EventSourceHandler):
else:
# Send a keepalive comment if the queue was empty
self.write_message(msg="", event="keepalive")
self.write_message("keepalive", "")
if self._spot_queue not in self._sse_spot_queues:
logging.error("Web server cleared up a queue of an active connection!")