mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-03 21:03:08 +00:00
refactor: use sequential processing for directory file diffs
Address PR review feedback: replace Promise.all with sequential for...of loop to avoid exhausting file descriptors when processing directories with many files.
This commit is contained in:
@@ -77,10 +77,12 @@ Binary file ${cleanPath} added
|
|||||||
// Empty directory
|
// Empty directory
|
||||||
return createNewFileDiff(cleanPath, '040000', ['[Empty directory]']);
|
return createNewFileDiff(cleanPath, '040000', ['[Empty directory]']);
|
||||||
}
|
}
|
||||||
// Generate diffs for all files in the directory
|
// Generate diffs for all files in the directory sequentially
|
||||||
const diffs = await Promise.all(
|
// Using sequential processing to avoid exhausting file descriptors on large directories
|
||||||
filesInDir.map((filePath) => generateSyntheticDiffForNewFile(basePath, filePath))
|
const diffs: string[] = [];
|
||||||
);
|
for (const filePath of filesInDir) {
|
||||||
|
diffs.push(await generateSyntheticDiffForNewFile(basePath, filePath));
|
||||||
|
}
|
||||||
return diffs.join('');
|
return diffs.join('');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user