From 89f6c52be1324be7805ab938c3c9e4bbe9b1f3f0 Mon Sep 17 00:00:00 2001 From: Daniel Herzig Date: Fri, 25 Jul 2025 20:13:28 -0500 Subject: [PATCH] fix: Attempt to cut down start up time for downloaded files --- src/parser-includes.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/parser-includes.ts b/src/parser-includes.ts index f11fcf0a9..f63af1127 100644 --- a/src/parser-includes.ts +++ b/src/parser-includes.ts @@ -158,11 +158,18 @@ export class ParserIncludes { break; } else { const localFileName = `${cwd}/${stateDir}/includes/${gitData.remote.host}/${projectPath}/${ref}/${f}`; - // Check remotely only if the file does not exist locally - if (!fs.existsSync(localFileName) && !(await Utils.remoteFileExist(cwd, f, ref, domain, projectPath, gitData.remote.schema, gitData.remote.port))) { + const fileExists = fs.existsSync(localFileName); + // If the file already has been downloaded, skip it + if (fileExists) { continue; } + // Check remotely only if the file does not exist locally + const remoteFileExists = await Utils.remoteFileExist(cwd, f, ref, domain, projectPath, gitData.remote.schema, gitData.remote.port); + if (!remoteFileExists) { + continue + } + const fileDoc = { include: { project: projectPath,