From 5d0a22f5c352f200394512e7733fa1273f9a25da Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Sat, 3 Sep 2011 10:39:11 +0200 Subject: [PATCH] monitor: perform doc deletes before updates. Start processing the queue as soon as it s big enough even if interval not expired --- src/index/rclmonprc.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/index/rclmonprc.cpp b/src/index/rclmonprc.cpp index 75ad40d5..aa05c540 100644 --- a/src/index/rclmonprc.cpp +++ b/src/index/rclmonprc.cpp @@ -497,19 +497,14 @@ bool startMonitor(RclConfig *conf, int opts) // Unlock queue before processing lists rclEQ.unlock(); - // Process. We don't do this everytime but let the lists accumulate - // a little, this saves processing. + // Process. We don't do this every time but let the lists accumulate + // a little, this saves processing. Start at once if list is big. time_t now = time(0); - if (now - lastixtime > ixinterval) { + if ((now - lastixtime > ixinterval) || + (deleted.size() + modified.size() > 20)) { lastixtime = now; - if (!modified.empty()) { - modified.sort(); - modified.unique(); - if (!indexfiles(conf, modified)) - break; - modified.clear(); - didsomething = true; - } + // Used to do the modified list first, but it does seem + // smarter to make room first... if (!deleted.empty()) { deleted.sort(); deleted.unique(); @@ -518,6 +513,14 @@ bool startMonitor(RclConfig *conf, int opts) deleted.clear(); didsomething = true; } + if (!modified.empty()) { + modified.sort(); + modified.unique(); + if (!indexfiles(conf, modified)) + break; + modified.clear(); + didsomething = true; + } } // Recreate the auxiliary dbs every hour at most.