Force disk usage calculation when loading servers
This commit is contained in:
parent
373dbd355e
commit
afa6fb200e
|
@ -7,6 +7,7 @@ import (
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/pterodactyl/wings/api"
|
"github.com/pterodactyl/wings/api"
|
||||||
"github.com/remeh/sizedwaitgroup"
|
"github.com/remeh/sizedwaitgroup"
|
||||||
|
"os"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -111,6 +112,11 @@ 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
|
||||||
|
|
|
@ -158,7 +158,7 @@ func (s *Server) GetProcessConfiguration() (*api.ServerConfigurationResponse, *a
|
||||||
return api.NewRequester().GetServerConfiguration(s.Id())
|
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.
|
// actions that need to occur for it.
|
||||||
func (s *Server) HandlePowerAction(action PowerAction) error {
|
func (s *Server) HandlePowerAction(action PowerAction) error {
|
||||||
switch action.Action {
|
switch action.Action {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user