Unverified Commit 20d286f7 authored by Shuning's avatar Shuning Committed by GitHub
Browse files

keyIsExpired checks server.loading before calling getExpire (#11393)



Seems excessive to call getExpire if we don't need it.
This can maybe have some speedup on AOF file loading (saving a dictFind call)
Co-authored-by: default avatarlvshuning <lvshuning@meituan.com>
parent ba1f09d3
...@@ -1612,14 +1612,14 @@ void propagateDeletion(redisDb *db, robj *key, int lazy) { ...@@ -1612,14 +1612,14 @@ void propagateDeletion(redisDb *db, robj *key, int lazy) {
/* Check if the key is expired. */ /* Check if the key is expired. */
int keyIsExpired(redisDb *db, robj *key) { int keyIsExpired(redisDb *db, robj *key) {
/* Don't expire anything while loading. It will be done later. */
if (server.loading) return 0;
mstime_t when = getExpire(db,key); mstime_t when = getExpire(db,key);
mstime_t now; mstime_t now;
if (when < 0) return 0; /* No expire for this key */ if (when < 0) return 0; /* No expire for this key */
/* Don't expire anything while loading. It will be done later. */
if (server.loading) return 0;
now = commandTimeSnapshot(); now = commandTimeSnapshot();
/* The key expired if the current (virtual or real) time is greater /* The key expired if the current (virtual or real) time is greater
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment