From 74caae342b3d677cda7c86d353c8291ccbf3ce9b Mon Sep 17 00:00:00 2001 From: Ian Renton Date: Fri, 5 Jun 2026 16:11:25 +0100 Subject: [PATCH] SSE server reliability improvements --- server/handlers/api/alerts.py | 4 ++-- server/handlers/api/spots.py | 4 ++-- templates/about.html | 2 +- templates/add_spot.html | 4 ++-- templates/alerts.html | 4 ++-- templates/bands.html | 6 +++--- templates/base.html | 8 ++++---- templates/conditions.html | 4 ++-- templates/map.html | 6 +++--- templates/spots.html | 6 +++--- templates/status.html | 4 ++-- 11 files changed, 26 insertions(+), 26 deletions(-) diff --git a/server/handlers/api/alerts.py b/server/handlers/api/alerts.py index 45ef63e..a48e1fb 100644 --- a/server/handlers/api/alerts.py +++ b/server/handlers/api/alerts.py @@ -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!") diff --git a/server/handlers/api/spots.py b/server/handlers/api/spots.py index d407e1d..6117752 100644 --- a/server/handlers/api/spots.py +++ b/server/handlers/api/spots.py @@ -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!") diff --git a/templates/about.html b/templates/about.html index 0bf67ce..e4f42be 100644 --- a/templates/about.html +++ b/templates/about.html @@ -69,7 +69,7 @@

This software is dedicated to the memory of Tom G1PJB, SK, a friend and colleague who sadly passed away around the time I started writing it in Autumn 2025. I was looking forward to showing it to you when it was done.

- + {% end %} \ No newline at end of file diff --git a/templates/add_spot.html b/templates/add_spot.html index c150923..922d2d9 100644 --- a/templates/add_spot.html +++ b/templates/add_spot.html @@ -69,8 +69,8 @@ - - + + {% end %} \ No newline at end of file diff --git a/templates/alerts.html b/templates/alerts.html index 51acbaf..7f3fee5 100644 --- a/templates/alerts.html +++ b/templates/alerts.html @@ -70,8 +70,8 @@ - - + + {% end %} \ No newline at end of file diff --git a/templates/bands.html b/templates/bands.html index 881a438..fb0c9c6 100644 --- a/templates/bands.html +++ b/templates/bands.html @@ -76,9 +76,9 @@ - - - + + + {% end %} \ No newline at end of file diff --git a/templates/base.html b/templates/base.html index bb458e0..6f11114 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,6 +1,6 @@ {% extends "skeleton.html" %} {% block head_extra %} - + @@ -19,9 +19,9 @@ integrity="sha384-L1eE4eD41kpBIWe2I0eHy+GnEUC4RIpcvibVW2JCminuPlTl+2Bc528iPdVMg5Dn" crossorigin="anonymous"> - - - + + + {% end %} {% block body %}
diff --git a/templates/conditions.html b/templates/conditions.html index a23b9c0..a3201ca 100644 --- a/templates/conditions.html +++ b/templates/conditions.html @@ -271,8 +271,8 @@
- - + + diff --git a/templates/map.html b/templates/map.html index 7cd8cdc..21c9ed4 100644 --- a/templates/map.html +++ b/templates/map.html @@ -94,9 +94,9 @@ - - - + + + {% end %} \ No newline at end of file diff --git a/templates/spots.html b/templates/spots.html index 4e30820..f876ab4 100644 --- a/templates/spots.html +++ b/templates/spots.html @@ -104,9 +104,9 @@ - - - + + + {% end %} \ No newline at end of file diff --git a/templates/status.html b/templates/status.html index a6f5611..a10c38f 100644 --- a/templates/status.html +++ b/templates/status.html @@ -59,8 +59,8 @@ - - + +