1、反向下单 暂时提交

This commit is contained in:
2025-07-26 09:09:09 +08:00
parent 3013486dd4
commit 771c617da4
44 changed files with 2018 additions and 614 deletions

View File

@ -84,3 +84,44 @@ func UserSubscribeInit(orm *gorm.DB, ctx context.Context) {
}
})
}
// 重启连接
func RestartConnect() error {
spotSockets := excservice.SpotSockets
futuresSockets := excservice.FutureSockets
timeOut := 22 * time.Hour
for _, item := range spotSockets {
//超过22小时重新连接
if time.Since(item.ConnectTime) > timeOut {
if err := item.ReplaceConnection(); err != nil {
log.Errorf("现货重启连接失败 key:%s,error:%s", item.GetKey(), err)
}
}
}
for _, item := range futuresSockets {
//超过22小时重新连接
if time.Since(item.ConnectTime) > timeOut {
if err := item.ReplaceConnection(); err != nil {
log.Errorf("合约重启连接失败 key:%s,error:%s", item.GetKey(), err)
}
}
}
return nil
}
// 假死重启
func DeadCheck() {
spotSockets := excservice.SpotSockets
futuresSockets := excservice.FutureSockets
for _, item := range spotSockets {
item.DeadCheck()
}
for _, item := range futuresSockets {
item.DeadCheck()
}
}