fix(classifier): drop vestigial Save-All delays that masked a fixed await bug

saveAllFiles() carried a 200ms inter-operation sleep "to prevent race
conditions" plus a 300ms post-error "settle" sleep. But saveFile() is fully
awaited and each iteration renames a distinct file, so the saves are already
serialized — the sleeps were the band-aid for an earlier missing-await bug
(the "ensure properly awaited" comment marks where that got fixed). Remove
both: correctness comes from the awaits, the operations are independent, and
Save All no longer pays 200ms per file (≈10s on a 50-file batch).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
ZDDC 2026-05-21 17:07:28 -05:00
parent d91a37f356
commit 86d667309d

View file

@ -755,10 +755,10 @@
const { file, index } = modifiedFiles[i]; const { file, index } = modifiedFiles[i];
try { try {
// Add small delay between operations to prevent race conditions // No inter-operation delay: saveFile() is fully awaited and
if (i > 0) { // each iteration renames a distinct file, so the saves are
await new Promise(resolve => setTimeout(resolve, 200)); // already serialized. (The old 200ms sleep papered over an
} // earlier missing-await bug, since fixed.)
// Validate before saving // Validate before saving
const newFilename = computeNewFilename(file, index); const newFilename = computeNewFilename(file, index);
@ -801,8 +801,8 @@
errorCount++; errorCount++;
errors.push(`${zddc.joinExtension(file.originalFilename, file.extension)}: ${saveErr.message}`); errors.push(`${zddc.joinExtension(file.originalFilename, file.extension)}: ${saveErr.message}`);
// Add delay after errors to let filesystem stabilize // No post-error delay: each file is independent, so an
await new Promise(resolve => setTimeout(resolve, 300)); // error on one doesn't require "settling" before the next.
} }
} catch (err) { } catch (err) {
console.error(`Error processing file ${index}:`, err); console.error(`Error processing file ${index}:`, err);