mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Perf: use Bun.peek() to save a few ticks
This commit is contained in:
@@ -27,13 +27,19 @@ export const buildDomesticRuleset = task(import.meta.path, async (span) => {
|
||||
'This file contains known addresses that are avaliable in the Mainland China.'
|
||||
];
|
||||
|
||||
const promise = getDomesticDomainsRulesetPromise();
|
||||
const peeked = Bun.peek(promise);
|
||||
const res: string[] = peeked === promise
|
||||
? await promise
|
||||
: (peeked as string[]);
|
||||
|
||||
return Promise.all([
|
||||
createRuleset(
|
||||
span,
|
||||
'Sukka\'s Ruleset - Domestic Domains',
|
||||
rulesetDescription,
|
||||
new Date(),
|
||||
await getDomesticDomainsRulesetPromise(),
|
||||
res,
|
||||
'ruleset',
|
||||
path.resolve(import.meta.dir, '../List/non_ip/domestic.conf'),
|
||||
path.resolve(import.meta.dir, '../Clash/non_ip/domestic.txt')
|
||||
|
||||
Reference in New Issue
Block a user