Avoid posting unnecessary async tasks
Former-commit-id: 08f63fdfd6c78388bba093ec2edda7d77fc9173e
This commit is contained in:
parent
635ddad7fc
commit
571718f774
8
src/gc.h
8
src/gc.h
@ -49,6 +49,12 @@ public:
|
||||
m_setepochOutstanding.clear();
|
||||
}
|
||||
|
||||
bool empty() const
|
||||
{
|
||||
std::unique_lock<fastlock> lock(m_lock);
|
||||
return m_vecepochs.empty();
|
||||
}
|
||||
|
||||
void endEpoch(uint64_t epoch, bool fNoFree = false)
|
||||
{
|
||||
std::unique_lock<fastlock> lock(m_lock);
|
||||
@ -109,7 +115,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
fastlock m_lock { "Garbage Collector"};
|
||||
mutable fastlock m_lock { "Garbage Collector"};
|
||||
|
||||
std::vector<EpochHolder> m_vecepochs;
|
||||
std::unordered_set<uint64_t> m_setepochOutstanding;
|
||||
|
@ -2441,6 +2441,7 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
|
||||
ProcessPendingAsyncWrites();
|
||||
|
||||
run_with_period(10) {
|
||||
if (!g_pserver->garbageCollector.empty()) {
|
||||
// Server threads don't free the GC, but if we don't have a
|
||||
// a bgsave or some other async task then we'll hold onto the
|
||||
// data for too long
|
||||
@ -2449,6 +2450,7 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
|
||||
g_pserver->garbageCollector.endEpoch(epoch);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
g_pserver->cronloops++;
|
||||
return 1000/g_pserver->hz;
|
||||
|
@ -1852,6 +1852,11 @@ public:
|
||||
garbageCollectorGeneric.endEpoch(epochGeneric, fNoFree);
|
||||
}
|
||||
|
||||
bool empty()
|
||||
{
|
||||
return garbageCollectorGeneric.empty() && garbageCollectorSnapshot.empty();
|
||||
}
|
||||
|
||||
void shutdown()
|
||||
{
|
||||
garbageCollectorSnapshot.shutdown();
|
||||
|
Loading…
x
Reference in New Issue
Block a user