|
|
|
@ -141,19 +141,19 @@ func (s *RedisStore) MaySaveNewTrans(global *storage.TransGlobalStore, branches |
|
|
|
AppendGid(global.Gid). |
|
|
|
AppendObject(global). |
|
|
|
AppendRaw(global.NextCronTime.Unix()). |
|
|
|
AppendRaw(global.Gid). |
|
|
|
AppendBranches(branches) |
|
|
|
global.Steps = nil |
|
|
|
global.Payloads = nil |
|
|
|
_, err := callLua(a, `-- MaySaveNewTrans |
|
|
|
local gs = cjson.decode(ARGV[3]) |
|
|
|
local g = redis.call('GET', KEYS[1]) |
|
|
|
if g ~= false then |
|
|
|
return 'UNIQUE_CONFLICT' |
|
|
|
end |
|
|
|
|
|
|
|
redis.call('SET', KEYS[1], ARGV[3], 'EX', ARGV[2]) |
|
|
|
redis.call('ZADD', KEYS[3], ARGV[4], gs.gid) |
|
|
|
for k = 5, table.getn(ARGV) do |
|
|
|
redis.call('ZADD', KEYS[3], ARGV[4], ARGV[5]) |
|
|
|
for k = 6, table.getn(ARGV) do |
|
|
|
redis.call('RPUSH', KEYS[2], ARGV[k]) |
|
|
|
end |
|
|
|
redis.call('EXPIRE', KEYS[2], ARGV[2]) |
|
|
|
|