From 95f392fb2cff377a6db5ebaf03fd5548b66fa7ca Mon Sep 17 00:00:00 2001 From: Bjoern Rabenstein Date: Fri, 17 Oct 2014 13:55:54 +0200 Subject: [PATCH] Prevent an indexing death spiral. Change-Id: I86b20cd0830d02f87b2f020767257e2d3fb2033c --- storage/local/persistence.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/storage/local/persistence.go b/storage/local/persistence.go index e8d866b58d..1d4ceaaefc 100644 --- a/storage/local/persistence.go +++ b/storage/local/persistence.go @@ -824,7 +824,11 @@ loop: } select { case <-batchTimeout.C: - if batchSize > 0 { + // Only commit if we have something to commit _and_ + // nothing is waiting in the queue to be picked up. That + // prevents a death spiral if the LookupSet calls below + // are slow for some reason. + if batchSize > 0 && len(p.indexingQueue) == 0 { commitBatch() } else { batchTimeout.Reset(indexingBatchTimeout)