修复通道注册失败问题

This commit is contained in:
2025-12-05 18:57:52 +08:00
parent 5649a03c47
commit 9e237be21e
6 changed files with 17 additions and 22 deletions

View File

@@ -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
`

View File

@@ -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)
}
// 保存代理信息