diff --git a/classifier/js/spreadsheet.js b/classifier/js/spreadsheet.js index 4b01f26..c77832d 100644 --- a/classifier/js/spreadsheet.js +++ b/classifier/js/spreadsheet.js @@ -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);