mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-28 17:41:54 +08:00
Chore: housekeeping
This commit is contained in:
@@ -2,10 +2,10 @@
|
||||
const undici = require('undici');
|
||||
|
||||
// Enable HTTP/2 supports
|
||||
undici.setGlobalDispatcher(new undici.Agent({
|
||||
allowH2: true,
|
||||
pipelining: 10
|
||||
}));
|
||||
// undici.setGlobalDispatcher(new undici.Agent({
|
||||
// allowH2: true,
|
||||
// pipelining: 10
|
||||
// }));
|
||||
|
||||
const fetchWithRetry = /** @type {import('undici').fetch} */(require('@vercel/fetch-retry')(undici.fetch));
|
||||
module.exports.fetchWithRetry = fetchWithRetry;
|
||||
|
||||
@@ -202,7 +202,9 @@ async function processFilterRules(filterRulesUrl, fallbackUrls) {
|
||||
filterRules = (
|
||||
await Promise.any(
|
||||
[filterRulesUrl, ...(fallbackUrls || [])].map(async url => {
|
||||
const text = await fetchWithRetry(url, { signal: controller.signal }).then(r => r.text());
|
||||
const r = await fetchWithRetry(url, { signal: controller.signal });
|
||||
const text = await r.text();
|
||||
|
||||
controller.abort();
|
||||
return text;
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user