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:01 -04:00
parent 6dbe7db0da
commit 430609181e
2 changed files with 9 additions and 8 deletions

View File

@ -3678,13 +3678,11 @@ DeleteTransientQueriesTask::Initialize()
state = kError;
return;
}
fWalker = new BTrackerPrivate::TNodeWalker(path.Path());
fWalker = new BTrackerPrivate::TQueryWalker(kAttrQueryLastChange " != 0");
state = kAllocatedWalker;
}
const int32 kBatchCount = 100;
bool
DeleteTransientQueriesTask::GetSome()
{
@ -3707,10 +3705,8 @@ DeleteTransientQueriesTask::GetSome()
}
const int32 kDaysToExpire = 7;
static bool
QueryOldEnough(Model* model)
bool
DeleteTransientQueriesTask::QueryOldEnough(Model* model)
{
// check if it is old and ready to be deleted
time_t now = time(0);

View File

@ -370,11 +370,16 @@ protected:
kError
};
static bool QueryOldEnough(Model* model);
protected:
State state;
private:
BTrackerPrivate::TNodeWalker* fWalker;
static const int32 kBatchCount = 100;
static const int32 kDaysToExpire = 7;
BTrackerPrivate::TQueryWalker* fWalker;
};