Cleanup logic for getting a directory size; support cancelation during goroutine

This commit is contained in:
Dane Everitt
2020-04-18 15:31:34 -07:00
parent 9e0cacc076
commit 71d38ff62e
5 changed files with 88 additions and 44 deletions

View File

@@ -146,6 +146,10 @@ func (d *DockerEnvironment) OnBeforeStart() error {
return err
}
if !d.Server.Filesystem.HasSpaceAvailable() {
return errors.New("cannot start server, not enough disk space available")
}
// Always destroy and re-create the server container to ensure that synced data from
// the Panel is used.
if err := d.Client.ContainerRemove(context.Background(), d.Server.Uuid, types.ContainerRemoveOptions{RemoveVolumes: true}); err != nil {