Invalidate aeTimer when returning AE_NOMORE (#8022)

This commit is contained in:
tzongw 2020-11-11 18:10:54 +08:00 committed by GitHub
parent dd1f20edc5
commit d5059ba5e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5453,7 +5453,12 @@ int moduleTimerHandler(struct aeEventLoop *eventLoop, long long id, void *client
/* Reschedule the next timer or cancel it. */
if (next_period <= 0) next_period = 1;
return (raxSize(Timers) > 0) ? next_period : AE_NOMORE;
if (raxSize(Timers) > 0) {
return next_period;
} else {
aeTimer = -1;
return AE_NOMORE;
}
}
/* Create a new timer that will fire after `period` milliseconds, and will call