mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-11-07 09:43:43 +08:00
opt: close the old connection for mj and sd clients
This commit is contained in:
@@ -61,6 +61,10 @@ func (h *SdJobHandler) Client(c *gin.Context) {
|
||||
}
|
||||
|
||||
client := types.NewWsClient(ws)
|
||||
// close the existed connections
|
||||
if cli := h.pool.Clients.Get(uint(userId)); cli != nil {
|
||||
cli.Close()
|
||||
}
|
||||
h.pool.Clients.Put(uint(userId), client)
|
||||
logger.Infof("New websocket connected, IP: %s", c.RemoteIP())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user