Merge pull request #48 from pterodactyl/fix/race-2

Fix race condition on startup
This commit is contained in:
Dane Everitt 2020-08-06 08:09:41 -07:00 committed by GitHub
commit cba689136a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -1,5 +1,5 @@
build: build:
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -gcflags "all=-trimpath=/Users/dane/Sites/development/code" -o build/wings_linux_amd64 -v wings.go GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -gcflags "all=-trimpath=$(PWD)" -o build/wings_linux_amd64 -v wings.go
compress: compress:
upx --brute build/wings_* upx --brute build/wings_*

View File

@ -104,15 +104,15 @@ func FromConfiguration(data *api.ServerConfigurationResponse) (*Server, error) {
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. // Forces the configuration to be synced with the panel.
if err := s.SyncWithConfiguration(data); err != nil { if err := s.SyncWithConfiguration(data); err != nil {
return nil, err 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 return s, nil
} }