Browse Source

fix types

Alexander Rose 2 years ago
parent
commit
29e8fe7904
2 changed files with 3 additions and 2 deletions
  1. 1 1
      src/mol-task/util/user-timing.ts
  2. 2 1
      src/servers/model/utils/fetch-retry.ts

+ 1 - 1
src/mol-task/util/user-timing.ts

@@ -7,7 +7,7 @@
 import { Task } from '../task';
 import { isProductionMode } from '../../mol-util/debug';
 
-const hasPerformance = (typeof performance !== 'undefined') && performance.mark && performance.measure;
+const hasPerformance = (typeof performance !== 'undefined') && !!performance.mark && performance.measure;
 const timingEnabled = hasPerformance && !isProductionMode;
 
 export namespace UserTiming {

+ 2 - 1
src/servers/model/utils/fetch-retry.ts

@@ -19,7 +19,8 @@ function isRetriableNetworkError(error: any) {
 export async function fetchRetry(url: string, timeout: number, retryCount: number, onRetry?: () => void): Promise<Response> {
     const controller = new AbortController();
     const id = setTimeout(() => controller.abort(), timeout);
-    const result = await retryIf(() => fetch(url, { signal: controller.signal }), {
+    const signal = controller.signal as any; // TODO: fix type
+    const result = await retryIf(() => fetch(url, { signal }), {
         retryThenIf: r => r.status === 408 /** timeout */ || r.status === 429 /** too many requests */ || (r.status >= 500 && r.status < 600),
         // TODO test retryCatchIf
         retryCatchIf: e => isRetriableNetworkError(e),