mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-14 09:43:46 +01:00
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.
This commit is contained in:
parent
076deade02
commit
5b22d5ee03
2 changed files with 6 additions and 2 deletions
1
changelog.d/10455.bugfix
Normal file
1
changelog.d/10455.bugfix
Normal file
|
@ -0,0 +1 @@
|
|||
Fix `synapse_federation_server_oldest_inbound_pdu_in_staging` Prometheus metric to not report a max age of 51 years when the queue is empty.
|
|
@ -1227,11 +1227,14 @@ 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()
|
||||
|
||||
# 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
|
||||
|
|
Loading…
Reference in a new issue