Chore: housekeeping

This commit is contained in:
SukkaW
2023-10-16 22:52:08 +08:00
parent 36ef50cdbf
commit 697cea84ed
12 changed files with 227 additions and 291 deletions

View File

@@ -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;

View File

@@ -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;
})