mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-04 00:54:48 -04:00
Support enabling/disabling pushers (from MSC3881) (#13799)
Partial implementation of MSC3881
This commit is contained in:
parent
6bd8763804
commit
8ae42ab8fa
15 changed files with 294 additions and 71 deletions
|
@ -189,7 +189,9 @@ class ReplicationDataHandler:
|
|||
if row.deleted:
|
||||
self.stop_pusher(row.user_id, row.app_id, row.pushkey)
|
||||
else:
|
||||
await self.start_pusher(row.user_id, row.app_id, row.pushkey)
|
||||
await self.process_pusher_change(
|
||||
row.user_id, row.app_id, row.pushkey
|
||||
)
|
||||
elif stream_name == EventsStream.NAME:
|
||||
# We shouldn't get multiple rows per token for events stream, so
|
||||
# we don't need to optimise this for multiple rows.
|
||||
|
@ -334,13 +336,15 @@ class ReplicationDataHandler:
|
|||
logger.info("Stopping pusher %r / %r", user_id, key)
|
||||
pusher.on_stop()
|
||||
|
||||
async def start_pusher(self, user_id: str, app_id: str, pushkey: str) -> None:
|
||||
async def process_pusher_change(
|
||||
self, user_id: str, app_id: str, pushkey: str
|
||||
) -> None:
|
||||
if not self._notify_pushers:
|
||||
return
|
||||
|
||||
key = "%s:%s" % (app_id, pushkey)
|
||||
logger.info("Starting pusher %r / %r", user_id, key)
|
||||
await self._pusher_pool.start_pusher_by_id(app_id, pushkey, user_id)
|
||||
await self._pusher_pool.process_pusher_change_by_id(app_id, pushkey, user_id)
|
||||
|
||||
|
||||
class FederationSenderHandler:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue