diff --git a/src/db.c b/src/db.c index 62c8aa131..3a5cdc4e8 100644 --- a/src/db.c +++ b/src/db.c @@ -1140,7 +1140,7 @@ int keyIsExpired(redisDb *db, robj *key) { * only the first time it is accessed and not in the middle of the * script execution, making propagation to slaves / AOF consistent. * See issue #1525 on Github for more information. */ - mstime_t now = server.lua_caller ? server.lua_time_start : mstime(); + mstime_t now = server.lua_caller ? server.lua_time_start : server.cmd_start_mstime; return now > when; } diff --git a/src/server.c b/src/server.c index 7f0acaa5d..a314254fe 100644 --- a/src/server.c +++ b/src/server.c @@ -2730,6 +2730,7 @@ int processCommand(client *c) { queueMultiCommand(c); addReply(c,shared.queued); } else { + server.cmd_start_mstime = mstime(); call(c,CMD_CALL_FULL); c->woff = server.master_repl_offset; if (listLength(server.ready_keys)) diff --git a/src/server.h b/src/server.h index aa0ec37e9..72d1af041 100644 --- a/src/server.h +++ b/src/server.h @@ -1232,6 +1232,7 @@ struct redisServer { time_t timezone; /* Cached timezone. As set by tzset(). */ int daylight_active; /* Currently in daylight saving time. */ long long mstime; /* Like 'unixtime' but with milliseconds resolution. */ + mstime_t cmd_start_mstime; /* Pubsub */ dict *pubsub_channels; /* Map channels to list of subscribed clients */ list *pubsub_patterns; /* A list of pubsub_patterns */