From a02038704f698480eb8c8ac0bda4dc6b76637d6d Mon Sep 17 00:00:00 2001 From: SukkaW Date: Fri, 18 Aug 2023 23:36:52 +0800 Subject: [PATCH] Perf: speed up download previous build --- Build/download-previous-build.js | 21 ++++++++++++++------- Source/non_ip/domestic.js | 1 - 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Build/download-previous-build.js b/Build/download-previous-build.js index 0a9024d8..09d918c8 100644 --- a/Build/download-previous-build.js +++ b/Build/download-previous-build.js @@ -17,17 +17,24 @@ const fileExists = (path) => { (async () => { const filesList = []; + let allFileExists = true; + for await (const line of readFileByLine(resolve(__dirname, '../.gitignore'))) { - if (line.startsWith('List/') && !line.endsWith('/')) { - filesList.push(line); + if ( + ( + line.startsWith('List/') + || line.startsWith('Modules/') + ) && !line.endsWith('/') + ) { + allFileExists = await fileExists(join(__dirname, '..', line)); + + if (!allFileExists) { + break; + } } } - if ( - !((await Promise.all( - filesList.map(p => fileExists(join(__dirname, '..', p))) - )).some(exist => !exist)) - ) { + if (allFileExists) { console.log('All files exists, skip download.'); return; } diff --git a/Source/non_ip/domestic.js b/Source/non_ip/domestic.js index 66bae298..a2daaaa8 100644 --- a/Source/non_ip/domestic.js +++ b/Source/non_ip/domestic.js @@ -83,7 +83,6 @@ module.exports.DOMESTICS = /** @type {const} */({ ] }, BYTEDANCE: { - // Currently, bytedance all NS are pointed to AliDNS dns: '180.184.2.2', domains: [ 'bytecdn.cn',