mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-04 17:55:06 -04:00
Allow moving account data and receipts streams off master (#9104)
This commit is contained in:
parent
f08ef64926
commit
6633a4015a
27 changed files with 854 additions and 279 deletions
|
@ -32,10 +32,26 @@ class ReceiptsHandler(BaseHandler):
|
|||
self.server_name = hs.config.server_name
|
||||
self.store = hs.get_datastore()
|
||||
self.hs = hs
|
||||
self.federation = hs.get_federation_sender()
|
||||
hs.get_federation_registry().register_edu_handler(
|
||||
"m.receipt", self._received_remote_receipt
|
||||
)
|
||||
|
||||
# We only need to poke the federation sender explicitly if its on the
|
||||
# same instance. Other federation sender instances will get notified by
|
||||
# `synapse.app.generic_worker.FederationSenderHandler` when it sees it
|
||||
# in the receipts stream.
|
||||
self.federation_sender = None
|
||||
if hs.should_send_federation():
|
||||
self.federation_sender = hs.get_federation_sender()
|
||||
|
||||
# If we can handle the receipt EDUs we do so, otherwise we route them
|
||||
# to the appropriate worker.
|
||||
if hs.get_instance_name() in hs.config.worker.writers.receipts:
|
||||
hs.get_federation_registry().register_edu_handler(
|
||||
"m.receipt", self._received_remote_receipt
|
||||
)
|
||||
else:
|
||||
hs.get_federation_registry().register_instances_for_edu(
|
||||
"m.receipt", hs.config.worker.writers.receipts,
|
||||
)
|
||||
|
||||
self.clock = self.hs.get_clock()
|
||||
self.state = hs.get_state_handler()
|
||||
|
||||
|
@ -125,7 +141,8 @@ class ReceiptsHandler(BaseHandler):
|
|||
if not is_new:
|
||||
return
|
||||
|
||||
await self.federation.send_read_receipt(receipt)
|
||||
if self.federation_sender:
|
||||
await self.federation_sender.send_read_receipt(receipt)
|
||||
|
||||
|
||||
class ReceiptEventSource:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue