mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 09:06:06 -04:00
Add ability to shard the federation sender (#7798)
This commit is contained in:
parent
f1245dc3c0
commit
f299441cc6
15 changed files with 670 additions and 157 deletions
|
@ -293,20 +293,22 @@ class FederationAckCommand(Command):
|
|||
|
||||
Format::
|
||||
|
||||
FEDERATION_ACK <token>
|
||||
FEDERATION_ACK <instance_name> <token>
|
||||
"""
|
||||
|
||||
NAME = "FEDERATION_ACK"
|
||||
|
||||
def __init__(self, token):
|
||||
def __init__(self, instance_name, token):
|
||||
self.instance_name = instance_name
|
||||
self.token = token
|
||||
|
||||
@classmethod
|
||||
def from_line(cls, line):
|
||||
return cls(int(line))
|
||||
instance_name, token = line.split(" ")
|
||||
return cls(instance_name, int(token))
|
||||
|
||||
def to_line(self):
|
||||
return str(self.token)
|
||||
return "%s %s" % (self.instance_name, self.token)
|
||||
|
||||
|
||||
class RemovePusherCommand(Command):
|
||||
|
|
|
@ -238,7 +238,7 @@ class ReplicationCommandHandler:
|
|||
federation_ack_counter.inc()
|
||||
|
||||
if self._federation_sender:
|
||||
self._federation_sender.federation_ack(cmd.token)
|
||||
self._federation_sender.federation_ack(cmd.instance_name, cmd.token)
|
||||
|
||||
async def on_REMOVE_PUSHER(
|
||||
self, conn: AbstractConnection, cmd: RemovePusherCommand
|
||||
|
@ -527,7 +527,7 @@ class ReplicationCommandHandler:
|
|||
"""Ack data for the federation stream. This allows the master to drop
|
||||
data stored purely in memory.
|
||||
"""
|
||||
self.send_command(FederationAckCommand(token))
|
||||
self.send_command(FederationAckCommand(self._instance_name, token))
|
||||
|
||||
def send_user_sync(
|
||||
self, instance_id: str, user_id: str, is_syncing: bool, last_sync_ms: int
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue