Slightly experimental change to speed up indexer exit after interrupt by closing up all queues.
This commit is contained in:
+27
-24
@@ -236,20 +236,12 @@ bool FsIndexer::index(int flags)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef IDX_THREADS
|
||||
if (m_haveInternQ)
|
||||
m_iwqueue.waitIdle();
|
||||
if (m_haveSplitQ)
|
||||
m_dwqueue.waitIdle();
|
||||
m_db->waitUpdIdle();
|
||||
#endif // IDX_THREADS
|
||||
|
||||
shutdownQueues(walkok);
|
||||
if (m_missing) {
|
||||
string missing;
|
||||
m_missing->getMissingDescription(missing);
|
||||
if (!missing.empty()) {
|
||||
LOGINFO("FsIndexer::index missing helper program(s):\n" <<
|
||||
missing << "\n");
|
||||
LOGINFO("FsIndexer::index missing helper program(s):\n" << missing << "\n");
|
||||
}
|
||||
m_config->storeMissingHelperDesc(missing);
|
||||
}
|
||||
@@ -257,6 +249,29 @@ bool FsIndexer::index(int flags)
|
||||
return walkok;
|
||||
}
|
||||
|
||||
void FsIndexer::shutdownQueues(bool ok)
|
||||
{
|
||||
#ifdef IDX_THREADS
|
||||
if (!ok) {
|
||||
// Error or more probably interrupt. Discard everything for fast shutdown
|
||||
if (m_haveInternQ) {
|
||||
m_iwqueue.closeShop();
|
||||
}
|
||||
if (m_haveSplitQ) {
|
||||
m_dwqueue.closeShop();
|
||||
}
|
||||
m_db->closeQueue();
|
||||
}
|
||||
if (m_haveInternQ) {
|
||||
m_iwqueue.waitIdle();
|
||||
}
|
||||
if (m_haveSplitQ) {
|
||||
m_dwqueue.waitIdle();
|
||||
}
|
||||
m_db->waitUpdIdle();
|
||||
#endif // IDX_THREADS
|
||||
}
|
||||
|
||||
static bool matchesSkipped(
|
||||
const vector<string>& tdl, FsTreeWalker& walker, const string& path)
|
||||
{
|
||||
@@ -406,13 +421,7 @@ bool FsIndexer::indexFiles(list<string>& files, int flags)
|
||||
|
||||
ret = true;
|
||||
out:
|
||||
#ifdef IDX_THREADS
|
||||
if (m_haveInternQ)
|
||||
m_iwqueue.waitIdle();
|
||||
if (m_haveSplitQ)
|
||||
m_dwqueue.waitIdle();
|
||||
m_db->waitUpdIdle();
|
||||
#endif // IDX_THREADS
|
||||
shutdownQueues(ret);
|
||||
|
||||
// Purge possible orphan documents
|
||||
if (ret == true) {
|
||||
@@ -461,13 +470,7 @@ bool FsIndexer::purgeFiles(list<string>& files)
|
||||
|
||||
ret = true;
|
||||
out:
|
||||
#ifdef IDX_THREADS
|
||||
if (m_haveInternQ)
|
||||
m_iwqueue.waitIdle();
|
||||
if (m_haveSplitQ)
|
||||
m_dwqueue.waitIdle();
|
||||
m_db->waitUpdIdle();
|
||||
#endif // IDX_THREADS
|
||||
shutdownQueues(ret);
|
||||
LOGDEB("FsIndexer::purgeFiles: done\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -159,6 +159,7 @@ private:
|
||||
processonefile(RclConfig *config, const string &fn,
|
||||
const struct PathStat *,
|
||||
const map<string,string>& localfields);
|
||||
void shutdownQueues(bool);
|
||||
};
|
||||
|
||||
#endif /* _fsindexer_h_included_ */
|
||||
|
||||
Reference in New Issue
Block a user