From 2fed93c074b0d1e0875775535aba75f86f087c28 Mon Sep 17 00:00:00 2001 From: Fang-Pen Lin Date: Thu, 9 Jan 2025 12:46:39 -0800 Subject: [PATCH] Fix benchmark loop --- src/benchmarks/storage.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/benchmarks/storage.rs b/src/benchmarks/storage.rs index 59fab8e..713c185 100644 --- a/src/benchmarks/storage.rs +++ b/src/benchmarks/storage.rs @@ -22,7 +22,7 @@ impl StorageBenchmark { .create(true) .write(true) .open(&self.path)?; - while true { + while remaining_size > 0 { let chunk_size = min(self.chunk_size, remaining_size); let _written = file.write(&buf[..chunk_size])?; // Notice: somehow there's a bug or what making written size returning 0, which is @@ -30,7 +30,7 @@ impl StorageBenchmark { // based on the size we have written remaining_size -= chunk_size; } - file.sync_all(); + file.sync_all()?; let end = SystemTime::now(); let duration = end.duration_since(start)?; log::info!(