Skip to content

Commit

Permalink
修改:lua判断不等于nil
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaocong6 committed Sep 10, 2019
1 parent 7d9dc18 commit 654b492
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Lock/Redis/Lock.php
Expand Up @@ -253,7 +253,7 @@ private function initQueueLockProcess(Data $data)
local res = tonumber(redis.call('setnx', queueLockProcessName, 0))
if(res == 1)
if(res ~= nil and res == 1)
then
redis.call('expire', queueLockProcessName, expiration)
end
Expand All @@ -277,7 +277,7 @@ private function initQueueLockList(Data $data)
local lockProcessNum = tonumber(redis.call('get', queueLockProcessName))
local queueLockListLen = redis.call('llen', queueLockListName)
if(lockProcessNum == 0 and queueLockListLen == 0)
if(lockProcessNum ~= nil and lockProcessNum == 0 and queueLockListLen ~= nil and queueLockListLen == 0)
then
redis.call('lpush', queueLockListName, 1)
redis.call('expire', queueLockListName, expiration)
Expand Down Expand Up @@ -342,7 +342,7 @@ private function delQueueLockProcess(Data $data)
local queueLockProcessName = KEYS[1]
local currentQueueProcessNum = tonumber(redis.call('get', queueLockProcessName))
if(currentQueueProcessNum > 0)
if(currentQueueProcessNum ~= nil and currentQueueProcessNum > 0)
then
redis.call('decr', queueLockProcessName)
end
Expand Down

0 comments on commit 654b492

Please sign in to comment.