mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Housekeeping
This commit is contained in:
@@ -15,11 +15,11 @@ const pool = new Worktank({
|
||||
autoTerminate: 30000, // The interval of milliseconds at which to check if the pool can be automatically terminated, to free up resources, workers will be spawned up again if needed
|
||||
autoInstantiate: true,
|
||||
methods: {
|
||||
// eslint-disable-next-line object-shorthand -- workertank
|
||||
getMicrosoftCdnRuleset: async function (importMetaUrl: string): Promise<[domains: string[], domainSuffixes: string[]]> {
|
||||
// eslint-disable-next-line object-shorthand -- workertank
|
||||
getMicrosoftCdnRuleset: async function (__filename: string): Promise<[domains: string[], domainSuffixes: string[]]> {
|
||||
// TODO: createRequire is a temporary workaround for https://github.com/nodejs/node/issues/51956
|
||||
const { default: module } = await import('node:module');
|
||||
const __require = module.createRequire(importMetaUrl);
|
||||
const __require = module.createRequire(__filename);
|
||||
|
||||
const { HostnameSmolTrie } = __require('./lib/trie');
|
||||
const { PROBE_DOMAINS, DOMAINS, DOMAIN_SUFFIXES, BLACKLIST } = __require('./constants/microsoft-cdn') as typeof import('./constants/microsoft-cdn');
|
||||
@@ -51,7 +51,7 @@ const pool = new Worktank({
|
||||
export const getMicrosoftCdnRulesetPromise = once<Promise<[domains: string[], domainSuffixes: string[]]>>(async () => {
|
||||
const res = await pool.exec(
|
||||
'getMicrosoftCdnRuleset',
|
||||
[import.meta.url]
|
||||
[__filename]
|
||||
);
|
||||
pool.terminate();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user