From b9fb922e91e95988b334d3f53b147b0550b38e97 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Tue, 18 Aug 2020 21:46:17 -0700 Subject: [PATCH] Fix the race condition where the race is actually happening --- router/router_server.go | 4 +++- server/listeners.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/router/router_server.go b/router/router_server.go index 2d090f3..814d3f9 100644 --- a/router/router_server.go +++ b/router/router_server.go @@ -16,7 +16,9 @@ import ( func getServer(c *gin.Context) { s := GetServer(c.Param("server")) - c.JSON(http.StatusOK, s.Proc()) + p := *s.Proc() + + c.JSON(http.StatusOK, p) } // Returns the logs for a given server instance. diff --git a/server/listeners.go b/server/listeners.go index dd5e541..1bd4d07 100644 --- a/server/listeners.go +++ b/server/listeners.go @@ -50,7 +50,7 @@ func (s *Server) StartEventListeners() { // cause it to block until the first call is done calculating disk usage, which will // case stat events to pile up for the server. s.Filesystem.HasSpaceAvailable() - + s.emitProcUsage() } }