Skip to content
Snippets Groups Projects
Commit 29e8fe79 authored by Alexander Rose's avatar Alexander Rose
Browse files

fix types

parent baf3a607
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
import { Task } from '../task'; import { Task } from '../task';
import { isProductionMode } from '../../mol-util/debug'; 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; const timingEnabled = hasPerformance && !isProductionMode;
export namespace UserTiming { export namespace UserTiming {
......
...@@ -19,7 +19,8 @@ function isRetriableNetworkError(error: any) { ...@@ -19,7 +19,8 @@ function isRetriableNetworkError(error: any) {
export async function fetchRetry(url: string, timeout: number, retryCount: number, onRetry?: () => void): Promise<Response> { export async function fetchRetry(url: string, timeout: number, retryCount: number, onRetry?: () => void): Promise<Response> {
const controller = new AbortController(); const controller = new AbortController();
const id = setTimeout(() => controller.abort(), timeout); 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), retryThenIf: r => r.status === 408 /** timeout */ || r.status === 429 /** too many requests */ || (r.status >= 500 && r.status < 600),
// TODO test retryCatchIf // TODO test retryCatchIf
retryCatchIf: e => isRetriableNetworkError(e), retryCatchIf: e => isRetriableNetworkError(e),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment