Fix race condition on startup

This commit is contained in:
Matthew Penner
2020-08-05 21:13:01 -06:00
parent 642e6e6a96
commit ff7f92895c
2 changed files with 6 additions and 6 deletions

View File

@@ -104,15 +104,15 @@ func FromConfiguration(data *api.ServerConfigurationResponse) (*Server, error) {
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.
if err := s.SyncWithConfiguration(data); err != nil {
return nil, err
}
// If the server's data directory exists, force disk usage calculation.
if _, err := os.Stat(s.Filesystem.Path()); err == nil {
go s.Filesystem.HasSpaceAvailable()
}
return s, nil
}