HomePhabricator
Diffusion Comm 85ad52f0ed44

[web-db] improve persisting lifecycle

Description

[web-db] improve persisting lifecycle

Summary:
Previous version with _throttle might cause problems when persisting will be longer than 300ms (thanks @tomek for identifying).

Change previous approach to the following algorithm:

  1. If there was a write operation and there is no ongoing persisting process (persistInProgress: false) - start persisting
  2. If there was a write operation and there is an ongoing persisting process - mark that it will need to be restarted (set persistNeeded: true).
  3. If persisting process finishes and there was a write operation (persistNeeded: true) - start it again and mark that it no longer needs to be restarted (persistNeeded: false)
  4. If persisting process finishes and there was no write operation - finish and mark that there is no ongoing persisting process (persistInProgress: false)
  5. Each time persisting process is starting set persistInProgress: true

Depends on D7288

Test Plan:

  1. Test if persistence works
  2. Add sleep and check if it works for long persistence

Reviewers: michal, tomek

Reviewed By: tomek

Subscribers: ashoat, atul, tomek

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

Details

Provenance
kamilAuthored on Apr 3 2023, 5:45 AM
Reviewer
tomek
Differential Revision
D7289: [web-db] improve persisting lifecycle
Parents
rCOMM458a0db0527a: [web-db] implement clearing sensitive data
Branches
Unknown
Tags
Unknown