Skip to content
This repository has been archived by the owner on May 25, 2022. It is now read-only.

Fix/lock lowdb file #470

Merged
merged 4 commits into from
Feb 10, 2022
Merged

Fix/lock lowdb file #470

merged 4 commits into from
Feb 10, 2022

Conversation

MGibson1
Copy link
Member

@MGibson1 MGibson1 commented Feb 9, 2022

Type of change

  • Bug fix
  • New feature development
  • Tech debt (refactoring, code cleanup, dependency upgrades, etc)
  • Build/deploy pipeline (DevOps)
  • Other

Objective

We're seeing strange malformed data.json files during CLI testing. This attempts to fix by awaiting a lock on the lowdb data file.

Also used tslint rule no-floating-promises to detect and await any floating promises in the client. Note: un-awaited promises may still exist in jslib.

fixes bitwarden/clients#2733

Code changes

  • package*: Add proper-lockfile as we did in directory-connector
  • bw.ts: use new lowdbStorageService
  • lowdbStorageService: copied from directory connector. Provides a lockDbFile method to the base implementation
  • delete and unlock commands: await floating promise

Testing requirements

Attempt to cause db lock issues with long chains of bw and repeated commands.

Before you submit

  • I have checked for linting errors (npm run lint) (required)
  • This change requires a documentation update (notify the documentation team)
  • This change has particular deployment requirements (notify the DevOps team)

Draft reason

Going to see about testing before putting up for review.

@MGibson1 MGibson1 requested a review from a team February 9, 2022 20:23
@MGibson1 MGibson1 marked this pull request as draft February 9, 2022 20:23
@MGibson1 MGibson1 marked this pull request as ready for review February 10, 2022 16:11
@MGibson1 MGibson1 merged commit ee66405 into master Feb 10, 2022
@MGibson1 MGibson1 deleted the fix/lock-lowdb-file branch February 10, 2022 16:24
MGibson1 added a commit that referenced this pull request Feb 10, 2022
* Lock data.json while running

* Await floating promises

* Increase retry frequency and attempt count for lock file

* tweak lock retry times

(cherry picked from commit ee66405)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

data.json doesn't populate upon login
2 participants