summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--changelog.d/12390.bugfix1
-rw-r--r--synapse/storage/databases/main/events.py6
2 files changed, 4 insertions, 3 deletions
diff --git a/changelog.d/12390.bugfix b/changelog.d/12390.bugfix
new file mode 100644
index 0000000000..159c6b3c0f
--- /dev/null
+++ b/changelog.d/12390.bugfix
@@ -0,0 +1 @@
+Fix a bug introduced in Synapse 1.49.0 which caused the `synapse_event_persisted_position` metric to have invalid values.
diff --git a/synapse/storage/databases/main/events.py b/synapse/storage/databases/main/events.py
index 57489c30f1..3fcd5f5b99 100644
--- a/synapse/storage/databases/main/events.py
+++ b/synapse/storage/databases/main/events.py
@@ -197,9 +197,9 @@ class PersistEventsStore:
             )
             persist_event_counter.inc(len(events_and_contexts))
 
-            if stream < 0:
-                # backfilled events have negative stream orderings, so we don't
-                # want to set the event_persisted_position to that.
+            if not use_negative_stream_ordering:
+                # we don't want to set the event_persisted_position to a negative
+                # stream_ordering.
                 synapse.metrics.event_persisted_position.set(stream)
 
             for event, context in events_and_contexts: