-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Implements part of MSC3944 by dropping cancelled&duplicated m.room_key_request
#15842
base: develop
Are you sure you want to change the base?
Conversation
m.room_key_request
e635be7
to
2a61c8b
Compare
m.room_key_request
m.room_key_request
m.room_key_request
m.room_key_request
if ( | ||
self._msc3944_enabled | ||
and message_type == ToDeviceEventTypes.RoomKeyRequest | ||
and user_id == sender_user_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am curious as to why the check is here for user_id
== sender_user_id
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to drop only your own key requests (not the one from the others) but since MSC3944 is pretty strict in what we drop (unlike my previous PR) I think you are right and it's safe to remove this condition.
if await self.store.delete_device_message( | ||
stream_id | ||
): | ||
previous_request_deleted = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks correct but the nested if
s and for
s on lines ~264-296 are a bit mind-melting to parse, is it possible to refactor or encapsulate some more of the logic so it's easier to keep track of what's happening?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed it's a lot of imbricated if/for. I'll try to do better.
return False | ||
return True | ||
|
||
async def get_all_device_messages( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any concern about performance with this function if the device inbox is very large? Presumably we can't just grab the RoomKeyRequest
s because that information is locked away in the Json
blobs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the perf I am not sure. get_messages_for_user_devices
is kind of unbounded too.
I can narrow down the set of keys by using a LIKE
with the key type on the JSON blob. Is it worth it, I am not sure.
MSC3944
Pull Request Checklist
EventStore
toEventWorkerStore
.".code blocks
.(run the linters)
Related to #3599.