mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Chore: housekeeping
This commit is contained in:
@@ -60,7 +60,8 @@ function createFetchRetry($fetch: typeof fetch): FetchWithRetry {
|
||||
retries: MAX_RETRIES,
|
||||
factor: FACTOR,
|
||||
maxRetryAfter: MAX_RETRY_AFTER,
|
||||
retryOnAborted: false
|
||||
retryOnAborted: false,
|
||||
retryOnNon2xx: true
|
||||
},
|
||||
opts.retry
|
||||
);
|
||||
@@ -85,6 +86,9 @@ function createFetchRetry($fetch: typeof fetch): FetchWithRetry {
|
||||
}
|
||||
throw new ResponseError(res);
|
||||
} else {
|
||||
if (!res.ok && retryOpts.retryOnNon2xx) {
|
||||
throw new ResponseError(res);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
} catch (err: unknown) {
|
||||
|
||||
@@ -79,5 +79,5 @@ export async function *createReadlineInterfaceFromResponse(resp: Response): Asyn
|
||||
}
|
||||
|
||||
export function fetchRemoteTextByLine(url: string | URL) {
|
||||
return fetchWithRetry(url, defaultRequestInit).then(res => createReadlineInterfaceFromResponse(res as Response));
|
||||
return fetchWithRetry(url, defaultRequestInit).then(res => createReadlineInterfaceFromResponse(res));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import fsp from 'fs/promises';
|
||||
import path from 'path';
|
||||
import { getGorhillPublicSuffixPromise } from './get-gorhill-publicsuffix';
|
||||
import { processDomainLists, processHosts } from './parse-filter';
|
||||
import { traceAsync, traceSync } from './trace-runner';
|
||||
|
||||
Reference in New Issue
Block a user