mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-06 13:34:58 -04:00
Fix bug where read-receipts lost their timestamps (#4927)
Make sure that they are sent correctly over the replication stream. Fixes: #4898
This commit is contained in:
parent
a54a44734f
commit
9bde730ef8
8 changed files with 179 additions and 12 deletions
|
@ -23,7 +23,7 @@ Each stream is defined by the following information:
|
|||
current_token: The function that returns the current token for the stream
|
||||
update_function: The function that returns a list of updates between two tokens
|
||||
"""
|
||||
|
||||
import itertools
|
||||
import logging
|
||||
from collections import namedtuple
|
||||
|
||||
|
@ -195,8 +195,8 @@ class Stream(object):
|
|||
limit=MAX_EVENTS_BEHIND + 1,
|
||||
)
|
||||
|
||||
if len(rows) >= MAX_EVENTS_BEHIND:
|
||||
raise Exception("stream %s has fallen behind" % (self.NAME))
|
||||
# never turn more than MAX_EVENTS_BEHIND + 1 into updates.
|
||||
rows = itertools.islice(rows, MAX_EVENTS_BEHIND + 1)
|
||||
else:
|
||||
rows = yield self.update_function(
|
||||
from_token, current_token,
|
||||
|
@ -204,6 +204,11 @@ class Stream(object):
|
|||
|
||||
updates = [(row[0], self.ROW_TYPE(*row[1:])) for row in rows]
|
||||
|
||||
# check we didn't get more rows than the limit.
|
||||
# doing it like this allows the update_function to be a generator.
|
||||
if self._LIMITED and len(updates) >= MAX_EVENTS_BEHIND:
|
||||
raise Exception("stream %s has fallen behind" % (self.NAME))
|
||||
|
||||
defer.returnValue((updates, current_token))
|
||||
|
||||
def current_token(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue