Browse Source

remove additional decode in ChangeGlobalStatus

topic
yedf2 5 years ago
parent
commit
f63f8d6c5d
  1. 5
      dtmsvr/storage/redis/redis.go

5
dtmsvr/storage/redis/redis.go

@ -192,9 +192,8 @@ redis.call('EXPIRE', KEYS[2], ARGV[2])
func (s *RedisStore) ChangeGlobalStatus(global *storage.TransGlobalStore, newStatus string, updates []string, finished bool) { func (s *RedisStore) ChangeGlobalStatus(global *storage.TransGlobalStore, newStatus string, updates []string, finished bool) {
old := global.Status old := global.Status
global.Status = newStatus global.Status = newStatus
args := newArgList().AppendGid(global.Gid).AppendObject(global).AppendRaw(old).AppendRaw(finished) args := newArgList().AppendGid(global.Gid).AppendObject(global).AppendRaw(old).AppendRaw(finished).AppendRaw(global.Gid)
_, err := callLua(args, `-- ChangeGlobalStatus _, err := callLua(args, `-- ChangeGlobalStatus
local gs = cjson.decode(ARGV[3])
local old = redis.call('GET', KEYS[1]) local old = redis.call('GET', KEYS[1])
if old == false then if old == false then
return 'NOT_FOUND' return 'NOT_FOUND'
@ -205,7 +204,7 @@ if os.status ~= ARGV[4] then
end end
redis.call('SET', KEYS[1], ARGV[3], 'EX', ARGV[2]) redis.call('SET', KEYS[1], ARGV[3], 'EX', ARGV[2])
if ARGV[5] == '1' then if ARGV[5] == '1' then
redis.call('ZREM', KEYS[3], gs.gid) redis.call('ZREM', KEYS[3], ARGV[6])
end end
`) `)
dtmimp.E2P(err) dtmimp.E2P(err)

Loading…
Cancel
Save