From 87ac89b082565106b1a1e0a30a68e92b6a83ec95 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Thu, 2 Sep 2021 23:16:24 +0300 Subject: [PATCH] index: rely less on dir tstamp when indexing Let's use the _current time_ (time(NULL)) instead of the dir-tstamp for a maildir; this avoids re-indexing mail where the mails have a newer time, but their directory hasn't (e.g. 'touch') Experimental, let see how this works. --- lib/index/mu-indexer.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/index/mu-indexer.cc b/lib/index/mu-indexer.cc index 9a43316e..1fd4e1cd 100644 --- a/lib/index/mu-indexer.cc +++ b/lib/index/mu-indexer.cc @@ -123,7 +123,7 @@ Indexer::Private::handler (const std::string& fullpath, struct stat *statbuf, // tstamps may not bubble up. dirstamp_ = store_.dirstamp(fullpath); if (conf_.lazy_check && - dirstamp_ == statbuf->st_mtime && + dirstamp_ >= statbuf->st_mtime && htype == Scanner::HandleType::EnterNewCur) { g_debug("skip %s (seems up-to-date)", fullpath.c_str()); return false; @@ -151,7 +151,7 @@ Indexer::Private::handler (const std::string& fullpath, struct stat *statbuf, } case Scanner::HandleType::LeaveDir: { - store_.set_dirstamp(fullpath, statbuf->st_mtime); + store_.set_dirstamp(fullpath, ::time(NULL)); return true; }