From 90bd1d4bcb78ea4bab1454a7f4e1e5f1bf537a51 Mon Sep 17 00:00:00 2001 From: Dustin Sallings Date: Fri, 25 Jun 2010 14:17:24 -0700 Subject: [PATCH] Always sleep a minimum of 1s between flushes. This has the downside of making it take at least a second to flush a new item, but it's expected that any system with write volume will probably have a good deal of traffic flowing through it, at which point it won't make a huge difference. Change-Id: I1ccaf7d1d39cd4f5df70c8daed5bc555b6995a09 Reviewed-on: http://review.northscale.com/915 Reviewed-by: Sean Lynch Tested-by: Sean Lynch --- flusher.cc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/flusher.cc b/flusher.cc index c7f7aeed9..213d791d1 100644 --- a/flusher.cc +++ b/flusher.cc @@ -144,15 +144,11 @@ bool Flusher::step(Dispatcher &d, TaskId tid) { case running: { int n = doFlush(); - if (n > 0) { - if (_state == running) { - d.snooze(tid, n); - return true; - } else { - return false; - } - } else { + if (_state == running) { + d.snooze(tid, std::max(n, 1)); return true; + } else { + return false; } } case stopping: