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:
Richard van der Hoff 2019-03-25 16:38:05 +00:00 committed by GitHub
parent a54a44734f
commit 9bde730ef8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 179 additions and 12 deletions

View file

@ -223,14 +223,25 @@ class BaseReplicationStreamProtocol(LineOnlyReceiver):
return
# Now lets try and call on_<CMD_NAME> function
try:
run_as_background_process(
"replication-" + cmd.get_logcontext_id(),
getattr(self, "on_%s" % (cmd_name,)),
cmd,
)
except Exception:
logger.exception("[%s] Failed to handle line: %r", self.id(), line)
run_as_background_process(
"replication-" + cmd.get_logcontext_id(),
self.handle_command,
cmd,
)
def handle_command(self, cmd):
"""Handle a command we have received over the replication stream.
By default delegates to on_<COMMAND>
Args:
cmd (synapse.replication.tcp.commands.Command): received command
Returns:
Deferred
"""
handler = getattr(self, "on_%s" % (cmd.NAME,))
return handler(cmd)
def close(self):
logger.warn("[%s] Closing connection", self.id())