修复通道注册失败问题
This commit is contained in:
@@ -259,10 +259,14 @@ func addChans(chans []netip.AddrPort) error {
|
||||
var RedisScriptAddChans = `
|
||||
local free_key = KEYS[1]
|
||||
local all_key = KEYS[2]
|
||||
local chans = ARGV
|
||||
local chans = ARGV
|
||||
|
||||
redis.call("SADD", free_key, unpack(chans))
|
||||
redis.call("SADD", all_key, unpack(chans))
|
||||
local batch_size = 5000
|
||||
for i = 1, #chans, batch_size do
|
||||
local end_index = math.min(i + batch_size - 1, #chans)
|
||||
redis.call("SADD", free_key, unpack(chans, i, end_index))
|
||||
redis.call("SADD", all_key, unpack(chans, i, end_index))
|
||||
end
|
||||
|
||||
return 1
|
||||
`
|
||||
|
||||
@@ -40,7 +40,7 @@ func (s *proxyService) RegisterBaiyin(Mac string, IP netip.Addr, username, passw
|
||||
}
|
||||
err := addChans(chans)
|
||||
if err != nil {
|
||||
return core.NewServErr("添加通道失败")
|
||||
return core.NewServErr("添加通道失败", err)
|
||||
}
|
||||
|
||||
// 保存代理信息
|
||||
|
||||
Reference in New Issue
Block a user