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.
This commit is contained in:
Dirk-Jan C. Binnema 2021-09-02 23:16:24 +03:00
parent f769476a51
commit 87ac89b082
1 changed files with 2 additions and 2 deletions

View File

@ -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;
}