mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-28 17:41:54 +08:00
Chore: Housekeeping
This commit is contained in:
@@ -14,7 +14,7 @@ import { processLine } from './lib/process-line';
|
||||
import { TTL, deserializeArray, fsFetchCache, serializeArray } from './lib/cache-filesystem';
|
||||
import { createMemoizedPromise } from './lib/memo-promise';
|
||||
|
||||
import * as SetHelpers from 'mnemonist/set';
|
||||
import { setAddFromArrayCurried } from './lib/set-add-from-array';
|
||||
|
||||
const s = new Sema(2);
|
||||
|
||||
@@ -83,11 +83,11 @@ const querySpeedtestApi = async (keyword: string): Promise<Array<string | null>>
|
||||
};
|
||||
|
||||
const getPreviousSpeedtestDomainsPromise = createMemoizedPromise(async () => {
|
||||
const domains = new Set<string>();
|
||||
const domains: string[] = [];
|
||||
for await (const l of await fetchRemoteTextByLine('https://ruleset.skk.moe/List/domainset/speedtest.conf')) {
|
||||
const line = processLine(l);
|
||||
if (line) {
|
||||
domains.add(line);
|
||||
domains.push(line);
|
||||
}
|
||||
}
|
||||
return domains;
|
||||
@@ -182,9 +182,11 @@ export const buildSpeedtestDomainSet = task(import.meta.path, async (span) => {
|
||||
'mensura.cdn-apple.com' // From netQuality command
|
||||
]);
|
||||
|
||||
await span.traceChildAsync('fetch previous speedtest domainset', async () => {
|
||||
SetHelpers.add(domains, await getPreviousSpeedtestDomainsPromise());
|
||||
});
|
||||
await span.traceChildAsync(
|
||||
'fetch previous speedtest domainset',
|
||||
() => getPreviousSpeedtestDomainsPromise()
|
||||
.then(setAddFromArrayCurried(domains))
|
||||
);
|
||||
|
||||
await new Promise<void>((resolve) => {
|
||||
const pMap = ([
|
||||
|
||||
Reference in New Issue
Block a user