You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Collections] Shorten hold to lock on db close (#3392)
Motivation:
Sometimes package-collection CLI subcommand ends with "Error: [Failed to close database]".
A new `SQLitePackageCollectionsStorage` is created then destroyed for each subcommand execution. The initialization includes populating in-memory trie using data in SQLite (`populateTargetTrie`) and may take a while to complete depending on the number and size of configured collectons. There is logic in `SQLitePackageCollectionsStorage.close` to signal `populateTargetTrie` to stop, but because it keeps holding on to `stateLock`, it prevents `populateTargetTrie` from determining if it should stop and causes the "database is locked" error.
Modifications:
Break down the `withStateLock` block in `close` to smaller blocks such that `retryClose` is called outside of it. This allows `populateTargetTrie` to read `state` and exit if needed.
0 commit comments