Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/Redis/DistLock.pm
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ end
' }
sub RELEASE_SHA1() { sha1_hex( RELEASE_SCRIPT ) }
sub EXTEND_SCRIPT() { '
if redis.call( "set", KEYS[1], ARGV[1], "XX", "PX", ARGV[2] ) then
return "OK"
if redis.call( "get", KEYS[1] ) == ARGV[1] then
if redis.call( "set", KEYS[1], ARGV[1], "XX", "PX", ARGV[2] ) then
return "OK"
end
else
return redis.call( "set", KEYS[1], ARGV[1], "NX", "PX", ARGV[2] )
end
Expand Down