summary refs log tree commit diff
path: root/synapse/storage/databases/main
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2021-07-13 11:33:15 +0100
committerGitHub <noreply@github.com>2021-07-13 11:33:15 +0100
commit879d8c1ee1703a0f612b7f442409d2fcded587d6 (patch)
tree50a95479524c81b9a737fa2c1f1d59a4ae67e376 /synapse/storage/databases/main
parentReplace `room_depth.min_depth` with a BIGINT (#10289) (diff)
downloadsynapse-879d8c1ee1703a0f612b7f442409d2fcded587d6.tar.xz
Fix federation inbound age metric. (#10355)
We should be reporting the age rather than absolute timestamp.
Diffstat (limited to 'synapse/storage/databases/main')
-rw-r--r--synapse/storage/databases/main/event_federation.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/synapse/storage/databases/main/event_federation.py b/synapse/storage/databases/main/event_federation.py
index c4474df975..4e06938849 100644
--- a/synapse/storage/databases/main/event_federation.py
+++ b/synapse/storage/databases/main/event_federation.py
@@ -1230,7 +1230,9 @@ class EventFederationWorkerStore(EventsWorkerStore, SignatureWorkerStore, SQLBas
                 "SELECT coalesce(min(received_ts), 0) FROM federation_inbound_events_staging"
             )
 
-            (age,) = txn.fetchone()
+            (received_ts,) = txn.fetchone()
+
+            age = self._clock.time_msec() - received_ts
 
             return count, age