mirror of
https://github.com/nezhahq/nezha.git
synced 2025-01-22 20:58:14 -05:00
refactor graceful shutdown
This commit is contained in:
parent
606e10ca0a
commit
7fb015b07d
@ -93,7 +93,6 @@ func main() {
|
|||||||
grpcL := m.Match(cmux.HTTP2HeaderField("content-type", "application/grpc"))
|
grpcL := m.Match(cmux.HTTP2HeaderField("content-type", "application/grpc"))
|
||||||
httpL := m.Match(cmux.HTTP1Fast())
|
httpL := m.Match(cmux.HTTP1Fast())
|
||||||
|
|
||||||
// TODO 使用 cmux 在同一端口服务 HTTP 和 gRPC
|
|
||||||
singleton.CleanMonitorHistory()
|
singleton.CleanMonitorHistory()
|
||||||
go rpc.ServeRPC(grpcL)
|
go rpc.ServeRPC(grpcL)
|
||||||
serviceSentinelDispatchBus := make(chan model.Monitor) // 用于传递服务监控任务信息的channel
|
serviceSentinelDispatchBus := make(chan model.Monitor) // 用于传递服务监控任务信息的channel
|
||||||
@ -110,7 +109,7 @@ func main() {
|
|||||||
log.Println("NEZHA>> Graceful::START")
|
log.Println("NEZHA>> Graceful::START")
|
||||||
singleton.RecordTransferHourlyUsage()
|
singleton.RecordTransferHourlyUsage()
|
||||||
log.Println("NEZHA>> Graceful::END")
|
log.Println("NEZHA>> Graceful::END")
|
||||||
srv.Shutdown(c)
|
m.Close()
|
||||||
return nil
|
return nil
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
log.Printf("NEZHA>> ERROR: %v", err)
|
log.Printf("NEZHA>> ERROR: %v", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user