1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00:00

[PM-15444] Increase WASM timeout to 10s (#12158)

* Increase WASM timeout to 10s

* Change time to 3s, add logService with debug log
This commit is contained in:
Oscar Hinton
2024-11-28 11:58:09 +01:00
committed by GitHub
parent d4395d841d
commit 59686346d4
4 changed files with 45 additions and 7 deletions

View File

@@ -32,13 +32,33 @@ import { SdkService } from "../../abstractions/sdk/sdk.service";
import { compareValues } from "../../misc/compare-values";
import { EncryptedString } from "../../models/domain/enc-string";
export class RecoverableSDKError extends Error {
sdk: BitwardenClient;
timeout: number;
constructor(sdk: BitwardenClient, timeout: number) {
super(`SDK took ${timeout}s to initialize`);
this.sdk = sdk;
this.timeout = timeout;
}
}
export class DefaultSdkService implements SdkService {
private sdkClientCache = new Map<UserId, Observable<BitwardenClient>>();
client$ = this.environmentService.environment$.pipe(
concatMap(async (env) => {
const settings = this.toSettings(env);
return await this.sdkClientFactory.createSdkClient(settings, LogLevel.Info);
try {
return await this.sdkClientFactory.createSdkClient(settings, LogLevel.Info);
} catch (e) {
if (e instanceof RecoverableSDKError) {
await this.failedToInitialize("sdk", e);
return e.sdk;
}
throw e;
}
}),
shareReplay({ refCount: true, bufferSize: 1 }),
);