mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-30 06:12:03 +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
|
||||
return createNewFileDiff(cleanPath, '040000', ['[Empty directory]']);
|
||||
}
|
||||
// Generate diffs for all files in the directory
|
||||
const diffs = await Promise.all(
|
||||
filesInDir.map((filePath) => generateSyntheticDiffForNewFile(basePath, filePath))
|
||||
);
|
||||
// Generate diffs for all files in the directory sequentially
|
||||
// Using sequential processing to avoid exhausting file descriptors on large directories
|
||||
const diffs: string[] = [];
|
||||
for (const filePath of filesInDir) {
|
||||
diffs.push(await generateSyntheticDiffForNewFile(basePath, filePath));
|
||||
}
|
||||
return diffs.join('');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user