HomePhabricator
Diffusion Comm b4a47bf8409d

[web] Handle shared worker message sequentially

Description

[web] Handle shared worker message sequentially

Summary:
ENG-6209

On native we have e.g. crypto thread or database thread to guarantee that operations will be happen sequentially. This diff brings the same for worker (db, olm) operations. I considered having different "task queues" per message db (e.g. db or olm) but I don't think it's worth as it complicates the code a lot (based on the native code). If this turns out to be a performance problem we can consider changes.

Depends on D11275

Test Plan:

  • Test if the app still works
  • Add a new dummy worker message and add await new Promise(resolve => setTimeout(resolve, 3000)); to it, so resolving it takes 3s
    • Without changes if multiple requests were scheduled then all of them resolved after ~3s one after another
    • With the changes there was a 3s delay between each of them

Reviewers: kamil, tomek

Reviewed By: kamil

Subscribers: ashoat

Differential Revision: https://phab.comm.dev/D11299

Details

Provenance
Michal Gniadek <michal.gniadek@swmansion.com>Authored on Mar 11 2024, 6:27 AM
Reviewer
kamil
Differential Revision
D11299: [web] Handle shared worker message sequentially
Parents
rCOMM256042b21aae: [web] Replace $FlowFixMe with any
Branches
Unknown
Tags
Unknown

Event Timeline