Don't accidentally reset a server's state when starting it after a system reboot; closes pterodactyl/panel#2695

This commit is contained in:
Dane Everitt
2020-11-10 21:21:20 -08:00
parent 488ef9de54
commit ffb6bd72ef
2 changed files with 9 additions and 11 deletions

View File

@@ -15,15 +15,14 @@ import (
// Attach to the instance and then automatically emit an event whenever the resource usage for the
// server process changes.
func (e *Environment) pollResources(ctx context.Context) error {
l := log.WithField("container_id", e.Id)
l.Debug("starting resource polling for container")
defer l.Debug("stopped resource polling for container")
if e.st.Load() == environment.ProcessOfflineState {
return errors.New("cannot enable resource polling on a stopped server")
}
l := log.WithField("container_id", e.Id)
l.Debug("starting resource polling for container")
defer l.Debug("stopped resource polling for container")
stats, err := e.client.ContainerStats(context.Background(), e.Id, true)
if err != nil {
return errors.WithStackIf(err)