Page MenuHomePhabricator

[native] Migrate to new id schema
ClosedPublic

Authored by michal on Jun 30 2023, 3:23 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Dec 15, 10:38 PM
Unknown Object (File)
Sun, Dec 15, 10:38 PM
Unknown Object (File)
Sun, Dec 15, 10:38 PM
Unknown Object (File)
Sun, Dec 15, 10:38 PM
Unknown Object (File)
Sun, Dec 15, 10:38 PM
Unknown Object (File)
Sun, Dec 15, 10:37 PM
Unknown Object (File)
Sun, Dec 15, 10:22 PM
Unknown Object (File)
Thu, Nov 28, 5:06 AM
Subscribers

Details

Summary
Test Plan
  • Run the old version of the app, create some drafts, close the app
  • Run the new version of the app, check if drafts still exist
  • Explore the app, check if there are any problems
  • Compare redux and sqlite from before and after, and check if all ids were converted

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kamil requested changes to this revision.Jul 3 2023, 7:21 AM

I think there is a performance problem here, you call getClientDBStore() at least twice, which is a very heavy operation and executes in sequence things that can be wrapped in Promise.all. Can you refactor this to:

  • call getClientDBStore() only once and make the entire logic operate on this result
  • create promises and put them into Promise.all?
native/redux/persist.js
598–606 ↗(On Diff #28287)

can this be defined in a separate function with a descriptive name?

602 ↗(On Diff #28287)

I think it's better to use keyserverPrefixID instead of 256

611–620 ↗(On Diff #28287)

my comments from updateClientDBMessageStoreThreads also applies here

This revision now requires changes to proceed.Jul 3 2023, 7:21 AM

Get all stores at the same time and await all updates concurrently. Extract conversion functions.

Looks a lot better!

lib/utils/migration-utils.js
68 ↗(On Diff #28380)

I saw this expression multiple times, I would prefer to create a simple function, sth like attachKeyserverID() but up to you

native/redux/persist.js
642 ↗(On Diff #28380)

I think it is better to avoid magic numbers

This revision is now accepted and ready to land.Jul 4 2023, 8:12 AM
This revision is now accepted and ready to land.Jul 18 2023, 6:37 AM