summary refs log tree commit diff
path: root/synapse/storage/databases
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2021-07-27 18:01:04 +0100
committerGitHub <noreply@github.com>2021-07-27 18:01:04 +0100
commit5b22d5ee033f2c251bb06d2bd9e0e729df89f90f (patch)
treedff1690e3b014e604567a3f942f4e120a6ed5d5a /synapse/storage/databases
parentallow specifying https:// proxy (#10411) (diff)
downloadsynapse-5b22d5ee033f2c251bb06d2bd9e0e729df89f90f.tar.xz
Fix `oldest_pdu_in_federation_staging` (#10455)
If the staging area was empty we'd report an age of 51 years, which is
not true or helpful.
Diffstat (limited to 'synapse/storage/databases')
-rw-r--r--synapse/storage/databases/main/event_federation.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/synapse/storage/databases/main/event_federation.py b/synapse/storage/databases/main/event_federation.py
index d39368c20e..f4a00b0736 100644
--- a/synapse/storage/databases/main/event_federation.py
+++ b/synapse/storage/databases/main/event_federation.py
@@ -1227,12 +1227,15 @@ class EventFederationWorkerStore(EventsWorkerStore, SignatureWorkerStore, SQLBas
             (count,) = txn.fetchone()
 
             txn.execute(
-                "SELECT coalesce(min(received_ts), 0) FROM federation_inbound_events_staging"
+                "SELECT min(received_ts) FROM federation_inbound_events_staging"
             )
 
             (received_ts,) = txn.fetchone()
 
-            age = self._clock.time_msec() - received_ts
+            # If there is nothing in the staging area default it to 0.
+            age = 0
+            if received_ts is not None:
+                age = self._clock.time_msec() - received_ts
 
             return count, age