Only flush periodically (every 64 chunks)

This commit is contained in:
Niklas Jensen
2026-01-15 20:11:55 +01:00
committed by Rune Harlyk
parent 6b96d0deba
commit d00e7bc92d
+5 -2
View File
@@ -317,8 +317,11 @@ socket_message_FSUploadChunkResponse FileSystemHandler::handleUploadChunk(const
return fs_up_response; return fs_up_response;
} }
// Flush to ensure data is written // Flush periodically to prevent LittleFS buffer issues (every 64 chunks = ~64KB with 1KB chunks)
state.file.flush(); if (state.chunksProcessed > 0 && state.chunksProcessed % 64 == 0) {
ESP_LOGI(TAG, "Flushing file at chunk %u", state.chunksProcessed);
state.file.flush();
}
state.chunksProcessed++; state.chunksProcessed++;
fs_up_response.success = true; fs_up_response.success = true;