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:
@@ -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);
|
||||||
|
|||||||
@@ -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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user