#
zhou zhou
6 天以前 480d4f9f5c31d8169d449241b1efea9936eb238f
rsf-server/src/main/resources/wms-lua/location-claim.lua
@@ -1,19 +1,8 @@
local mode = ARGV[1]
local occupyValue = ARGV[2]
local taskValue = ARGV[3]
local ttl = tonumber(ARGV[4])
local occupyValue = ARGV[1]
local ttl = tonumber(ARGV[2])
if mode == 'PUTAWAY' then
  if redis.call('exists', KEYS[1]) == 1 or redis.call('exists', KEYS[2]) == 1 then
    return 0
  end
  redis.call('psetex', KEYS[1], ttl, occupyValue)
  redis.call('psetex', KEYS[2], ttl, taskValue)
  return 1
end
if redis.call('exists', KEYS[2]) == 1 then
if redis.call('exists', KEYS[1]) == 1 then
  return 0
end
redis.call('psetex', KEYS[2], ttl, taskValue)
redis.call('psetex', KEYS[1], ttl, occupyValue)
return 1