mirror of
https://github.com/element-hq/synapse.git
synced 2026-08-28 23:08:22 +00:00
Comment why we use .START (and refactor to make it a .START)
This commit is contained in:
@@ -1005,9 +1005,9 @@ class SlidingSyncExtensionHandler:
|
||||
if not sticky_events_request.enabled:
|
||||
return None
|
||||
now = self.clock.time_msec()
|
||||
since_token = sticky_events_request.since or SlidingSyncStickyEventsToken(
|
||||
sticky_events_stream_id=0
|
||||
)
|
||||
# If there is no `since` token specified, start from the beginning of the stream
|
||||
# to make sure the client receives all visible (unexpired) sticky events
|
||||
since_token = sticky_events_request.since or SlidingSyncStickyEventsToken.START
|
||||
(
|
||||
sticky_events_to_id,
|
||||
room_to_event_ids,
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#
|
||||
#
|
||||
import re
|
||||
from typing import ClassVar
|
||||
|
||||
import pydantic_core.core_schema
|
||||
from pydantic import (
|
||||
@@ -126,6 +127,7 @@ class SlidingSyncStickyEventsToken:
|
||||
"""
|
||||
|
||||
PATTERN = re.compile(r"^sticky_([0-9]+)$")
|
||||
START: ClassVar["SlidingSyncStickyEventsToken"]
|
||||
|
||||
def __init__(self, *, sticky_events_stream_id: int) -> None:
|
||||
self.sticky_events_stream_id = sticky_events_stream_id
|
||||
@@ -160,6 +162,12 @@ class SlidingSyncStickyEventsToken:
|
||||
return self.serialise()
|
||||
|
||||
|
||||
# Starting reading a stream at 0 ensures all stream fact rows wlil be read
|
||||
SlidingSyncStickyEventsToken.START = SlidingSyncStickyEventsToken(
|
||||
sticky_events_stream_id=0
|
||||
)
|
||||
|
||||
|
||||
class SlidingSyncBody(RequestBodyModel):
|
||||
"""
|
||||
Sliding Sync API request body.
|
||||
|
||||
Reference in New Issue
Block a user