This PR changes the way we pick a client for decrypting an event, and caches the result so that it can be reused. This is intended to ensure that when the sender user isn't used for decryption, Appservice doesn't make repeated calls to get_joined_rooms, and when it picks a client it prefers one with encryption already enabled to save time.
We also update to ES2022 so I can use Error.cause, one of my favourite new ES features.
Checklist
[ ] Tests written for all new code
[x] Linter has been satisfied
[ ] Sign-off given on the changes (see CONTRIBUTING.md)
This PR changes the way we pick a client for decrypting an event, and caches the result so that it can be reused. This is intended to ensure that when the sender user isn't used for decryption, Appservice doesn't make repeated calls to get_joined_rooms, and when it picks a client it prefers one with encryption already enabled to save time.
We also update to ES2022 so I can use Error.cause, one of my favourite new ES features.
Checklist