mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Fix occasional glitches in the synapse_event_persisted_position metric
Every so often this metric glitched to a negative number. I'm assuming it was due to backfilled events.
This commit is contained in:
parent
16d9701892
commit
ca9bc1f4fe
@ -485,9 +485,14 @@ class EventsStore(EventFederationStore, EventsWorkerStore, BackgroundUpdateStore
|
|||||||
new_forward_extremeties=new_forward_extremeties,
|
new_forward_extremeties=new_forward_extremeties,
|
||||||
)
|
)
|
||||||
persist_event_counter.inc(len(chunk))
|
persist_event_counter.inc(len(chunk))
|
||||||
|
|
||||||
|
if not backfilled:
|
||||||
|
# backfilled events have negative stream orderings, so we don't
|
||||||
|
# want to set the event_persisted_position to that.
|
||||||
synapse.metrics.event_persisted_position.set(
|
synapse.metrics.event_persisted_position.set(
|
||||||
chunk[-1][0].internal_metadata.stream_ordering,
|
chunk[-1][0].internal_metadata.stream_ordering,
|
||||||
)
|
)
|
||||||
|
|
||||||
for event, context in chunk:
|
for event, context in chunk:
|
||||||
if context.app_service:
|
if context.app_service:
|
||||||
origin_type = "local"
|
origin_type = "local"
|
||||||
|
Loading…
Reference in New Issue
Block a user