-- RedisUpdateScript_v5 local key = KEYS[1] local countInc = tonumber(ARGV[1]) or 0 local totalMsInc = tonumber(ARGV[2]) or 0 local newMax = tonumber(ARGV[3]) local newMin = tonumber(ARGV[4]) local noReply = tonumber(ARGV[5]) local sentinel = tonumber(ARGV[6]) -- Incrementi redis.call('HINCRBY', key, 'count', countInc) redis.call('HINCRBYFLOAT', key, 'totalMs', totalMsInc) redis.call('HINCRBY', key, 'noReply', noReply) -- MAX local currentMaxStr = redis.call('HGET', key, 'maxMs') local currentMax = tonumber(currentMaxStr) if newMax ~= nil and newMax < sentinel then if currentMax == nil or newMax > currentMax then redis.call('HSET', key, 'maxMs', newMax) end end -- MIN local currentMinStr = redis.call('HGET', key, 'minMs') local currentMin = tonumber(currentMinStr) if newMin ~= nil and newMin < sentinel then if currentMin == nil or newMin < currentMin then redis.call('HSET', key, 'minMs', newMin) end end return 1