mirror of
https://review.haiku-os.org/haiku
synced 2024-11-23 07:18:40 +01:00
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:
parent
6dbe7db0da
commit
430609181e
@ -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);
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user