diff options
author | Shuning <36000971+lsn1994@users.noreply.github.com> | 2022-10-18 18:55:49 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-18 13:55:49 +0300 |
commit | 20d286f77eabccd657be66d3193556ea7ebe4d26 (patch) | |
tree | 818f77d546e210f02336b7495e874c6318460e9a /src | |
parent | ba1f09d3fecc4c1c52a1b7e17dea207939a5843d (diff) | |
download | redis-20d286f77eabccd657be66d3193556ea7ebe4d26.tar.gz |
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: lvshuning <lvshuning@meituan.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/db.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1612,14 +1612,14 @@ void propagateDeletion(redisDb *db, robj *key, int lazy) { /* Check if the key is expired. */ 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 now; 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(); /* The key expired if the current (virtual or real) time is greater |