Chore: minor changes [skip ci]

This commit is contained in:
SukkaW 2025-05-05 20:42:48 +08:00
parent fe5924f141
commit 4378989099

View File

@ -34,18 +34,24 @@ function onDomain(args: [string, boolean]) {
.crawl(SOURCE_DIR + path.sep + 'non_ip') .crawl(SOURCE_DIR + path.sep + 'non_ip')
.withPromise(); .withPromise();
const promises: Array<Promise<void>> = [];
await Promise.all([ await Promise.all([
...domainRules, ...domainRules,
...domainSets ...domainSets
].map(filepath => runAgainstSourceFile( ].map(
filepath, filepath => runAgainstSourceFile(
(domain: string, includeAllSubdomain: boolean) => queue.add( filepath,
() => keyedAsyncMutexWithQueue( (domain: string, includeAllSubdomain: boolean) => promises.push(queue.add(
domain, () => keyedAsyncMutexWithQueue(
() => isDomainAlive(domain, includeAllSubdomain) domain,
).then(onDomain) () => isDomainAlive(domain, includeAllSubdomain)
).then(() => console.log('[done]', filepath)) ).then(onDomain)
))); ))
).then(() => console.log('[crawl]', filepath))
));
await Promise.all(promises);
console.log(); console.log();
console.log(); console.log();