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