Skip to content

Commit 89f6c52

Browse files
author
Daniel Herzig
committed
fix: Attempt to cut down start up time for downloaded files
1 parent a7118db commit 89f6c52

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/parser-includes.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,18 @@ export class ParserIncludes {
158158
break;
159159
} else {
160160
const localFileName = `${cwd}/${stateDir}/includes/${gitData.remote.host}/${projectPath}/${ref}/${f}`;
161-
// Check remotely only if the file does not exist locally
162-
if (!fs.existsSync(localFileName) && !(await Utils.remoteFileExist(cwd, f, ref, domain, projectPath, gitData.remote.schema, gitData.remote.port))) {
161+
const fileExists = fs.existsSync(localFileName);
162+
// If the file already has been downloaded, skip it
163+
if (fileExists) {
163164
continue;
164165
}
165166

167+
// Check remotely only if the file does not exist locally
168+
const remoteFileExists = await Utils.remoteFileExist(cwd, f, ref, domain, projectPath, gitData.remote.schema, gitData.remote.port);
169+
if (!remoteFileExists) {
170+
continue
171+
}
172+
166173
const fileDoc = {
167174
include: {
168175
project: projectPath,

0 commit comments

Comments
 (0)