mirror of
https://github.com/giongto35/cloud-game.git
synced 2026-08-03 23:34:01 +00:00
Fix copy-by-value of sync.Lock in the monitoring server struct
This commit is contained in:
parent
bd701f10fc
commit
0f54e0fb15
1 changed files with 2 additions and 2 deletions
|
|
@ -16,7 +16,7 @@ import (
|
|||
type ServerMonitoring struct {
|
||||
cfg monitoring.ServerMonitoringConfig
|
||||
tag string
|
||||
server http.Server
|
||||
server *http.Server
|
||||
}
|
||||
|
||||
func NewServerMonitoring(cfg monitoring.ServerMonitoringConfig, tag string) *ServerMonitoring {
|
||||
|
|
@ -37,6 +37,7 @@ func (sm *ServerMonitoring) Run() error {
|
|||
Addr: fmt.Sprintf(":%d", sm.cfg.Port),
|
||||
Handler: monitoringServerMux,
|
||||
}
|
||||
sm.server = &srv
|
||||
glog.Infof("[%v] Starting monitoring server at %v", sm.tag, srv.Addr)
|
||||
|
||||
if sm.cfg.ProfilingEnabled {
|
||||
|
|
@ -62,7 +63,6 @@ func (sm *ServerMonitoring) Run() error {
|
|||
glog.Infof("[%v] Prometheus metric is enabled at %v", sm.tag, srv.Addr+metricPath)
|
||||
monitoringServerMux.Handle(metricPath, promhttp.Handler())
|
||||
}
|
||||
sm.server = srv
|
||||
return srv.ListenAndServe()
|
||||
}
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue