mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-28 17:41:54 +08:00
Perf: offload Telegram CIDR fetching into separate thread
This commit is contained in:
@@ -3,6 +3,7 @@ import { SHARED_DESCRIPTION } from './constants/description';
|
||||
import { RulesetOutput } from './lib/rules/ruleset';
|
||||
import Worktank from 'worktank';
|
||||
import { RULES } from './constants/microsoft-cdn';
|
||||
import { wait } from 'foxts/wait';
|
||||
|
||||
const pool = new Worktank({
|
||||
pool: {
|
||||
@@ -47,10 +48,10 @@ const pool = new Worktank({
|
||||
}
|
||||
});
|
||||
|
||||
export const getMicrosoftCdnRulesetPromise = pool.exec(
|
||||
export const getMicrosoftCdnRulesetPromise = wait(0).then(() => pool.exec(
|
||||
'getMicrosoftCdnRuleset',
|
||||
[__filename]
|
||||
).finally(() => pool.terminate());
|
||||
)).finally(() => pool.terminate());
|
||||
|
||||
export const buildMicrosoftCdn = task(require.main === module, __filename)(async (span) => {
|
||||
const [domains, domainSuffixes] = await span.traceChildPromise('get microsoft cdn domains', getMicrosoftCdnRulesetPromise);
|
||||
|
||||
Reference in New Issue
Block a user