Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 228d36a

Browse files
author
Mathieu Velten
committed
Delete pushers after calling on_logged_out module hook on device delete
1 parent d07d255 commit 228d36a

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

changelog.d/15410.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix untold assumption that `on_logged_out` module hooks will be called before pushers deletion.

docs/modules/password_auth_provider_callbacks.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ Called during a logout request for a user. It is passed the qualified user ID, t
103103
deactivated device (if any: access tokens are occasionally created without an associated
104104
device ID), and the (now deactivated) access token.
105105

106+
Deleting the related pushers is done after calling `on_logged_out`, so you can rely on them
107+
to still be present.
108+
106109
If multiple modules implement this callback, Synapse runs them all in order.
107110

108111
### `get_username_for_registration`

synapse/handlers/device.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,8 +513,6 @@ async def delete_devices(self, user_id: str, device_ids: List[str]) -> None:
513513
else:
514514
raise
515515

516-
await self.hs.get_pusherpool().remove_pushers_by_devices(user_id, device_ids)
517-
518516
# Delete data specific to each device. Not optimised as it is not
519517
# considered as part of a critical path.
520518
for device_id in device_ids:
@@ -533,6 +531,10 @@ async def delete_devices(self, user_id: str, device_ids: List[str]) -> None:
533531
f"org.matrix.msc3890.local_notification_settings.{device_id}",
534532
)
535533

534+
# Pushers are deleted after `delete_access_tokens_for_user` is called so that
535+
# modules using `on_logged_out` hook can use them if needed.
536+
await self.hs.get_pusherpool().remove_pushers_by_devices(user_id, device_ids)
537+
536538
await self.notify_device_update(user_id, device_ids)
537539

538540
async def update_device(self, user_id: str, device_id: str, content: dict) -> None:

0 commit comments

Comments
 (0)