Skip to content

Commit aaac257

Browse files
committed
Use cached time in expireCommand()
Should not be an issue given that the precision is the second here, at least if we are using a decent HZ value and the cached time refreshes enough times. So the cached time is only used if HZ is >= 10.
1 parent cd05a66 commit aaac257

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/db.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,8 @@ void expireGenericCommand(redisClient *c, long long basetime, int unit) {
912912
}
913913

914914
void expireCommand(redisClient *c) {
915-
expireGenericCommand(c,mstime(),UNIT_SECONDS);
915+
long long now = server.hz >= 10 ? server.mstime: mstime();
916+
expireGenericCommand(c,now,UNIT_SECONDS);
916917
}
917918

918919
void expireatCommand(redisClient *c) {

0 commit comments

Comments
 (0)