Skip to content

Commit

Permalink
ISSUE #4415 write the zombies in chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
carmenfan committed Aug 23, 2023
1 parent adac26f commit a6aa4a3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions backend/src/scripts/utility/fileshare/identifyZombieFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,12 @@ const run = async (outFile = DEFAULT_OUT_FILE, removeFiles = false, maxParallelR
if (zombies.length) {
logger.logInfo(`Writing all links to ${outFile}...`);

writeFileSync(outFile, zombies.join('\n'));
const chunks = splitArrayIntoChunks(zombies, maxParallelRefs);
for (let i = 0; i < chunks.length; ++i) {
writeFileSync(outFile, `${chunks[i].join('\n')}\n`, { flag: i === 0 ? 'w' : 'a' });
logger.logInfo(`[${i}/${chunks.length}] ${chunks[i].length} file paths written...`);
}
if (removeFiles) {
const chunks = splitArrayIntoChunks(zombies, maxParallelRefs);
logger.logInfo(`Deleting files (${chunks.length} batches)`);
for (let i = 0; i < chunks.length; ++i) {
const group = chunks[i];
Expand Down

0 comments on commit a6aa4a3

Please sign in to comment.