Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce Megolm blocking and add cancellation #3035

Merged
merged 4 commits into from
Jan 24, 2023

Commits on Jan 16, 2023

  1. Add async setImmediate util

    Adds an async/promise-based version of `setImmediate`. Note that, despite being
    poorly adopted, `setImmediate` is polyfilled, and should be more performant
    than `sleep(0)`.
    
    Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
    clarkf committed Jan 16, 2023
    Configuration menu
    Copy the full SHA
    ddce1bc View commit details
    Browse the repository at this point in the history
  2. Reduce blocking while pre-fetching Megolm keys

    Currently, calling `Client#prepareToEncrypt` in a megolm room has the potential
    to block for multiple seconds while it crunches numbers.
    
    Sleeping for 0 seconds (approximating `setImmediate`) allows the engine to
    process other events, updates, or re-renders in between checks.
    
    See
    - element-hq/element-web#21612
    - element-hq/element-web#11836
    
    Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
    clarkf committed Jan 16, 2023
    Configuration menu
    Copy the full SHA
    b76e7ca View commit details
    Browse the repository at this point in the history
  3. Make prepareToEncrypt cancellable.

    NOTE: This commit introduces a backwards-compatible API change.
    
    Adds the ability to cancel `MegolmEncryption#prepareToEncrypt` by returning
    a cancellation function. The bulk of the processing happens in
    `getDevicesInRoom`, which now accepts a 'getter' that allows the caller to
    indicate cancellation.
    
    See matrix-org#1255
    Closes matrix-org#1255
    
    Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
    clarkf committed Jan 16, 2023
    Configuration menu
    Copy the full SHA
    1ee487a View commit details
    Browse the repository at this point in the history

Commits on Jan 24, 2023

  1. Configuration menu
    Copy the full SHA
    40a4c8d View commit details
    Browse the repository at this point in the history