mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-12-24 05:19:25 -05:00
Experimental MSC3890 Implementation: Fix deleting account data when using an account data writer worker (#14869)
This commit is contained in:
parent
1eea662780
commit
15e975f68f
1
changelog.d/14869.bugfix
Normal file
1
changelog.d/14869.bugfix
Normal file
@ -0,0 +1 @@
|
|||||||
|
Fix a bug introduced in v1.75.0rc1 that caused experimental support for deleting account data to raise an internal server error while using an account data writer worker.
|
@ -155,9 +155,6 @@ class AccountDataHandler:
|
|||||||
max_stream_id = await self._store.remove_account_data_for_room(
|
max_stream_id = await self._store.remove_account_data_for_room(
|
||||||
user_id, room_id, account_data_type
|
user_id, room_id, account_data_type
|
||||||
)
|
)
|
||||||
if max_stream_id is None:
|
|
||||||
# The referenced account data did not exist, so no delete occurred.
|
|
||||||
return None
|
|
||||||
|
|
||||||
self._notifier.on_new_event(
|
self._notifier.on_new_event(
|
||||||
StreamKeyType.ACCOUNT_DATA, max_stream_id, users=[user_id]
|
StreamKeyType.ACCOUNT_DATA, max_stream_id, users=[user_id]
|
||||||
@ -230,9 +227,6 @@ class AccountDataHandler:
|
|||||||
max_stream_id = await self._store.remove_account_data_for_user(
|
max_stream_id = await self._store.remove_account_data_for_user(
|
||||||
user_id, account_data_type
|
user_id, account_data_type
|
||||||
)
|
)
|
||||||
if max_stream_id is None:
|
|
||||||
# The referenced account data did not exist, so no delete occurred.
|
|
||||||
return None
|
|
||||||
|
|
||||||
self._notifier.on_new_event(
|
self._notifier.on_new_event(
|
||||||
StreamKeyType.ACCOUNT_DATA, max_stream_id, users=[user_id]
|
StreamKeyType.ACCOUNT_DATA, max_stream_id, users=[user_id]
|
||||||
@ -248,7 +242,6 @@ class AccountDataHandler:
|
|||||||
instance_name=random.choice(self._account_data_writers),
|
instance_name=random.choice(self._account_data_writers),
|
||||||
user_id=user_id,
|
user_id=user_id,
|
||||||
account_data_type=account_data_type,
|
account_data_type=account_data_type,
|
||||||
content={},
|
|
||||||
)
|
)
|
||||||
return response["max_stream_id"]
|
return response["max_stream_id"]
|
||||||
|
|
||||||
|
@ -581,7 +581,7 @@ class AccountDataWorkerStore(PushRulesWorkerStore, CacheInvalidationWorkerStore)
|
|||||||
|
|
||||||
async def remove_account_data_for_room(
|
async def remove_account_data_for_room(
|
||||||
self, user_id: str, room_id: str, account_data_type: str
|
self, user_id: str, room_id: str, account_data_type: str
|
||||||
) -> Optional[int]:
|
) -> int:
|
||||||
"""Delete the room account data for the user of a given type.
|
"""Delete the room account data for the user of a given type.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -632,9 +632,7 @@ class AccountDataWorkerStore(PushRulesWorkerStore, CacheInvalidationWorkerStore)
|
|||||||
next_id,
|
next_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
if not row_updated:
|
if row_updated:
|
||||||
return None
|
|
||||||
|
|
||||||
self._account_data_stream_cache.entity_has_changed(user_id, next_id)
|
self._account_data_stream_cache.entity_has_changed(user_id, next_id)
|
||||||
self.get_room_account_data_for_user.invalidate((user_id,))
|
self.get_room_account_data_for_user.invalidate((user_id,))
|
||||||
self.get_account_data_for_room.invalidate((user_id, room_id))
|
self.get_account_data_for_room.invalidate((user_id, room_id))
|
||||||
@ -747,7 +745,7 @@ class AccountDataWorkerStore(PushRulesWorkerStore, CacheInvalidationWorkerStore)
|
|||||||
self,
|
self,
|
||||||
user_id: str,
|
user_id: str,
|
||||||
account_data_type: str,
|
account_data_type: str,
|
||||||
) -> Optional[int]:
|
) -> int:
|
||||||
"""
|
"""
|
||||||
Delete a single piece of user account data by type.
|
Delete a single piece of user account data by type.
|
||||||
|
|
||||||
@ -833,9 +831,7 @@ class AccountDataWorkerStore(PushRulesWorkerStore, CacheInvalidationWorkerStore)
|
|||||||
next_id,
|
next_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
if not row_updated:
|
if row_updated:
|
||||||
return None
|
|
||||||
|
|
||||||
self._account_data_stream_cache.entity_has_changed(user_id, next_id)
|
self._account_data_stream_cache.entity_has_changed(user_id, next_id)
|
||||||
self.get_global_account_data_for_user.invalidate((user_id,))
|
self.get_global_account_data_for_user.invalidate((user_id,))
|
||||||
self.get_global_account_data_by_type_for_user.prefill(
|
self.get_global_account_data_by_type_for_user.prefill(
|
||||||
|
Loading…
Reference in New Issue
Block a user