mirror of
https://github.com/fluencelabs/redis
synced 2025-06-13 09:11:20 +00:00
Update PR #6537 patch to for generality.
After the thread in #6537 and thanks to the suggestions received, this commit updates the original patch in order to: 1. Solve the problem of updating the time in multiple places by updating it in call(). 2. Avoid introducing a new field but use our cached time. This required some minor refactoring to the function updating the time, and the introduction of a new cached time in microseconds in order to use less gettimeofday() calls.
This commit is contained in:
8
src/db.c
8
src/db.c
@ -1198,8 +1198,12 @@ int keyIsExpired(redisDb *db, robj *key) {
|
||||
* blocked to when the Lua script started. This way a key can expire
|
||||
* 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 : server.cmd_start_mstime;
|
||||
* See issue #1525 on Github for more information.
|
||||
*
|
||||
* Outside the Lua script execution, we use the cached time server.mstime
|
||||
* that is updated before commands executions in call(). */
|
||||
mstime_t now = server.lua_caller ? server.lua_time_start :
|
||||
server.mstime;
|
||||
|
||||
return now > when;
|
||||
}
|
||||
|
Reference in New Issue
Block a user