From afa6fb200e757ca4f17324c9c42fe9840f4f8349 Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Fri, 31 Jul 2020 17:01:02 -0600 Subject: [PATCH] Force disk usage calculation when loading servers --- server/loader.go | 8 +++++++- server/server.go | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/server/loader.go b/server/loader.go index 70a7d30..4b189e4 100644 --- a/server/loader.go +++ b/server/loader.go @@ -7,6 +7,7 @@ import ( "github.com/pkg/errors" "github.com/pterodactyl/wings/api" "github.com/remeh/sizedwaitgroup" + "os" "time" ) @@ -108,7 +109,12 @@ func FromConfiguration(data *api.ServerConfigurationResponse) (*Server, error) { Server: s, } s.Filesystem = Filesystem{ - Server: s, + Server: s, + } + + // If the server's data directory exists, force disk usage calculation. + if _, err := os.Stat(s.Filesystem.Path()); err == nil { + go s.Filesystem.HasSpaceAvailable() } // Forces the configuration to be synced with the panel. diff --git a/server/server.go b/server/server.go index 7530f36..78d819b 100644 --- a/server/server.go +++ b/server/server.go @@ -158,7 +158,7 @@ func (s *Server) GetProcessConfiguration() (*api.ServerConfigurationResponse, *a return api.NewRequester().GetServerConfiguration(s.Id()) } -// Helper function that can receieve a power action and then process the +// Helper function that can receive a power action and then process the // actions that need to occur for it. func (s *Server) HandlePowerAction(action PowerAction) error { switch action.Action {