element-web
element-web copied to clipboard
batching of `m.room_key` to-device messages is suboptimal
When we send out m.room_key messages to share a new encryption session, we attempt to batch those messages into groups of 20 per call to /sendToDevice. However the batching logic is distinctly suboptimal and we often end up creating much smaller batches.
I'm also not really sure why 20 was chosen as the target.
This leads to lots of requests to the /sendToDevice endpoint and general slowness in sending out room keys, potentially causing unable-to-decrypt errors (https://github.com/vector-im/element-meta/issues/245) and causing the recipient to start sending out m.room_key_request messages, exacerbating the problem.
Likely we will fix this as part of https://github.com/vector-im/element-web/issues/21972 rather than spending time fixing it in an implementation that will be thrown away.
Rust SDK limit is set to 250
... and, more importantly, its batching logic looks sensible
Pending complement-crypto test to check that we batch in as large a chunk as possible i.e 250.
This was done.