1
0
mirror of https://github.com/bitwarden/cli synced 2026-01-19 16:13:12 +00:00

Fix/lock lowdb file (#470)

* Lock data.json while running

* Await floating promises

* Increase retry frequency and attempt count for lock file

* tweak lock retry times
This commit is contained in:
Matt Gibson
2022-02-10 10:24:41 -06:00
committed by GitHub
parent 2ae2fdfd14
commit ee664059d2
6 changed files with 115 additions and 1565 deletions

View File

@@ -10,6 +10,7 @@ import { LogLevelType } from "jslib-common/enums/logLevelType";
import { AuthService } from "jslib-common/services/auth.service";
import { I18nService } from "./services/i18n.service";
import { LowdbStorageService } from "./services/lowdbStorage.service";
import { NodeEnvSecureStorageService } from "./services/nodeEnvSecureStorage.service";
import { CliPlatformUtilsService } from "jslib-node/cli/services/cliPlatformUtils.service";
@@ -44,7 +45,6 @@ import { TwoFactorService } from "jslib-common/services/twoFactor.service";
import { UserVerificationService } from "jslib-common/services/userVerification.service";
import { VaultTimeoutService } from "jslib-common/services/vaultTimeout.service";
import { LowdbStorageService } from "jslib-node/services/lowdbStorage.service";
import { NodeApiService } from "jslib-node/services/nodeApi.service";
import { NodeCryptoFunctionService } from "jslib-node/services/nodeCryptoFunction.service";
@@ -129,7 +129,7 @@ export class Main {
(level) => process.env.BITWARDENCLI_DEBUG !== "true" && level <= LogLevelType.Info
);
this.cryptoFunctionService = new NodeCryptoFunctionService();
this.storageService = new LowdbStorageService(this.logService, null, p, false);
this.storageService = new LowdbStorageService(this.logService, null, p, false, true);
this.secureStorageService = new NodeEnvSecureStorageService(
this.storageService,
this.logService,