Fix issue where GC is not free'd until a BGSAVE

Former-commit-id: e19350005b571591876e49219bfca75e905604a5
This commit is contained in:
John Sully 2021-04-07 17:30:59 +00:00
parent 55a118ecd0
commit 635ddad7fc

View File

@ -2440,6 +2440,16 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
/* CRON functions may trigger async writes, so do this last */
ProcessPendingAsyncWrites();
run_with_period(10) {
// 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
g_pserver->asyncworkqueue->AddWorkFunction([]{
auto epoch = g_pserver->garbageCollector.startEpoch();
g_pserver->garbageCollector.endEpoch(epoch);
});
}
g_pserver->cronloops++;
return 1000/g_pserver->hz;
}