mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-28 12:45:45 +01:00
Only GetGlobals when we actually need them (#7855)
Since we only need it as a backup if accountVaultTimeoutAction is null/undefined, there should be no need to call this function every time. While the overhead may seem trivial at first glance, it can add up to a massive increase in runtime when the function is called repeatedly in quick succession (e.g. when running `bw list items` where it is executed once for every item). In my concrete case this change leads to a 20x speedup.
This commit is contained in:
parent
566423925d
commit
e823c27c8d
@ -2235,10 +2235,14 @@ export class StateService<
|
|||||||
const accountVaultTimeoutAction = (
|
const accountVaultTimeoutAction = (
|
||||||
await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()))
|
await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()))
|
||||||
)?.settings?.vaultTimeoutAction;
|
)?.settings?.vaultTimeoutAction;
|
||||||
const globalVaultTimeoutAction = (
|
return (
|
||||||
await this.getGlobals(this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()))
|
accountVaultTimeoutAction ??
|
||||||
)?.vaultTimeoutAction;
|
(
|
||||||
return accountVaultTimeoutAction ?? globalVaultTimeoutAction;
|
await this.getGlobals(
|
||||||
|
this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()),
|
||||||
|
)
|
||||||
|
)?.vaultTimeoutAction
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async setVaultTimeoutAction(value: string, options?: StorageOptions): Promise<void> {
|
async setVaultTimeoutAction(value: string, options?: StorageOptions): Promise<void> {
|
||||||
|
Loading…
Reference in New Issue
Block a user