修复:为 user-svc 添加健康检查和启动顺序控制

This commit is contained in:
fish
2026-03-28 21:54:09 +08:00
parent 5ac0a52bb1
commit c5260bcae8
31 changed files with 1995 additions and 167 deletions

View File

@@ -1,12 +1,11 @@
package router
import (
"encoding/json"
"log"
"net/http"
"backend/gateway/internal/service"
"backend/gateway/internal/ws"
"gateway/internal/service"
"gateway/internal/ws"
"github.com/gorilla/websocket"
)
@@ -54,11 +53,11 @@ func (r *Router) handleWebSocket(w http.ResponseWriter, req *http.Request) {
}
client := ws.NewClient(r.hub, conn)
r.hub.register <- client
r.hub.Register <- client
// 启动客户端的读写协程
go client.writePump()
go client.readPump()
go client.WritePump()
go client.ReadPump()
}
func (r *Router) handleHealth(w http.ResponseWriter, req *http.Request) {