Tracker: Use queries to find transient queries to delete.

Walking the entire filesystem is slow and wastes cache memory.
Instead, just use a TQueryWalker to find and iterate over queries.
This commit is contained in:
Augustin Cavalier
2024-10-18 13:30:20 -04:00
parent 6dbe7db0da
commit 430609181e
2 changed files with 9 additions and 8 deletions
+3 -7
View File
@@ -3678,13 +3678,11 @@ DeleteTransientQueriesTask::Initialize()
state = kError; state = kError;
return; return;
} }
fWalker = new BTrackerPrivate::TNodeWalker(path.Path()); fWalker = new BTrackerPrivate::TQueryWalker(kAttrQueryLastChange " != 0");
state = kAllocatedWalker; state = kAllocatedWalker;
} }
const int32 kBatchCount = 100;
bool bool
DeleteTransientQueriesTask::GetSome() DeleteTransientQueriesTask::GetSome()
{ {
@@ -3707,10 +3705,8 @@ DeleteTransientQueriesTask::GetSome()
} }
const int32 kDaysToExpire = 7; bool
DeleteTransientQueriesTask::QueryOldEnough(Model* model)
static bool
QueryOldEnough(Model* model)
{ {
// check if it is old and ready to be deleted // check if it is old and ready to be deleted
time_t now = time(0); time_t now = time(0);
+6 -1
View File
@@ -370,11 +370,16 @@ protected:
kError kError
}; };
static bool QueryOldEnough(Model* model);
protected: protected:
State state; State state;
private: private:
BTrackerPrivate::TNodeWalker* fWalker; static const int32 kBatchCount = 100;
static const int32 kDaysToExpire = 7;
BTrackerPrivate::TQueryWalker* fWalker;
}; };