Page MenuHomePhabricator

[lib][native][web] Wait for DB reset before generating QR
ClosedPublic

Authored by bartek on Mon, Apr 7, 4:16 AM.
Tags
None
Referenced Files
F5947480: D14554.id47703.diff
Fri, Apr 18, 10:46 AM
F5931683: D14554.id47702.diff
Fri, Apr 18, 4:43 AM
Unknown Object (File)
Wed, Apr 16, 1:31 PM
Unknown Object (File)
Wed, Apr 16, 10:42 AM
Unknown Object (File)
Mon, Apr 14, 10:22 PM
Unknown Object (File)
Mon, Apr 14, 2:56 PM
Unknown Object (File)
Mon, Apr 14, 10:11 AM
Unknown Object (File)
Mon, Apr 14, 3:58 AM
Subscribers

Details

Summary

Attempt to fix ENG-10307.

Added a global variable that tracks database deletion/reset status. Any naming suggestions appreciated.

Test Plan

Artificially added delay before calling sharedWorker.init() in handleSensitiveData on web, to simulate the race.
Without awaiting waitUntilDatabaseDeletion() before QR generation, I was getting outdated deviceID. When awaiting, the deviceID is correct.
With this change, I wasn't able to reproduce the original issue anymore.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bartek held this revision as a draft.
bartek published this revision for review.Mon, Apr 7, 4:27 AM
ashoat added inline comments.
lib/components/secondary-device-qr-auth-context-provider.react.js
96–98 ↗(On Diff #47693)

I would probably move this into a helper function inside wait-until-db-deleted.js. That way you can avoid implementing getDatabaseResetStatus() and just use currentDatabaseStatus directly. You could name the function waitUntilDatabaseReady()

lib/utils/wait-until-db-deleted.js
4–5 ↗(On Diff #47693)

Nit: we usually format these enums differently

10 ↗(On Diff #47693)

I would move this down, closer to where it's used

This revision is now accepted and ready to land.Mon, Apr 7, 7:03 AM
lib/components/secondary-device-qr-auth-context-provider.react.js
96–98 ↗(On Diff #47693)

Good idea, thank you

lib/utils/wait-until-db-deleted.js
4–5 ↗(On Diff #47693)

Address review feedback:

  • Enum casing
  • Declaration reorder
  • Introduced waitUntilDatabaseReady()
lib/utils/wait-until-db-deleted.js
4–5 ↗(On Diff #47693)
This revision was landed with ongoing or failed builds.Tue, Apr 8, 1:15 AM
This revision was automatically updated to reflect the committed changes.