From cc8b528bb4bce0fb35ba0f9313ea56364fb97594 Mon Sep 17 00:00:00 2001 From: Michael Peters Date: Thu, 6 Oct 2022 23:00:36 -0700 Subject: [PATCH] retab auto-verifier.ts --- src/client/webapp/auto-verifier.ts | 38 +++++++++++++++--------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/client/webapp/auto-verifier.ts b/src/client/webapp/auto-verifier.ts index e004e25..bdbf800 100644 --- a/src/client/webapp/auto-verifier.ts +++ b/src/client/webapp/auto-verifier.ts @@ -26,7 +26,7 @@ export enum AutoVerifierChangesType { export class AutoVerifier { public primaryPromise: Promise | null = null; public trustedPromise: Promise | null = null; - public verifyPromise: Promise | null = null; + public verifyPromise: Promise | null = null; public trustedStatus: 'none' | 'fetching' | 'verifying' | 'verified' = 'none'; private verifierId: string; @@ -175,7 +175,7 @@ export class AutoVerifier { } this.primaryPromise = null; this.trustedPromise = null; - this.verifyPromise = null; + this.verifyPromise = null; this.trustedStatus = 'none'; } @@ -250,7 +250,7 @@ export class AutoVerifier { // make sure to verify BEFORE potentially resolving // this way the conflicts can be resolved before the result is returned - this.verifyPromise = this.verifyFunc(primaryResult, trustedResult); + this.verifyPromise = this.verifyFunc(primaryResult, trustedResult); const primaryUpToDate = await this.verifyPromise; if (this.trustedPromise === origTrustedPromise) { @@ -285,22 +285,22 @@ export class AutoVerifier { if (this.trustedPromise !== origTrustedPromise) { // we've been invalidated while we were waiting for the trusted result! - console.warn( - 'ULTRA RARE ALERT: we got unverified while awaiting a trusted promise another path was verifying!', - ); + console.warn( + 'ULTRA RARE ALERT: we got unverified while awaiting a trusted promise another path was verifying!', + ); await tryResolveTrustedPromise(); return; } - const origVerifyPromise: Promise | null = this.verifyPromise; - await origVerifyPromise; // we don't care about the result, just that we wait for the verification to finish - if (this.verifyPromise !== origVerifyPromise) { + const origVerifyPromise: Promise | null = this.verifyPromise; + await origVerifyPromise; // we don't care about the result, just that we wait for the verification to finish + if (this.verifyPromise !== origVerifyPromise) { // we've been invalidated while we were waiting for the trusted result! - console.warn( - 'ULTRA RARE ALERT: we got unverified while awaiting a verify promise another path was calling!', - origVerifyPromise, - this.verifyPromise, - ); + console.warn( + 'ULTRA RARE ALERT: we got unverified while awaiting a verify promise another path was calling!', + origVerifyPromise, + this.verifyPromise, + ); await tryResolveTrustedPromise(); return; } @@ -321,15 +321,15 @@ export class AutoVerifier { await tryResolveTrustedPromise(); } catch (e: unknown) { if (!resolved) { - this.trustedPromise = null; // suppress warnings - this.primaryPromise = null; // suppress warnings - this.verifyPromise = null; // suppress warnings - this.unverify(); + this.trustedPromise = null; // suppress warnings + this.primaryPromise = null; // suppress warnings + this.verifyPromise = null; // suppress warnings + this.unverify(); // eslint-disable-next-line prefer-promise-reject-errors reject(e as Error); resolved = true; } else { - this.unverify() + this.unverify() console.warn('server request failed after returning cache value (or when already rejected)', e); } }