mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
b6db56b5eb
Restore the 1.10 logic that will reset the restart manager's timeout or backoff delay if a container executes longer than 10s reguardless of exit status or policy. Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
40 lines
916 B
Go
40 lines
916 B
Go
package libcontainerd
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
|
|
"github.com/docker/docker/restartmanager"
|
|
)
|
|
|
|
const (
|
|
// InitFriendlyName is the name given in the lookup map of processes
|
|
// for the first process started in a container.
|
|
InitFriendlyName = "init"
|
|
configFilename = "config.json"
|
|
)
|
|
|
|
type containerCommon struct {
|
|
process
|
|
restartManager restartmanager.RestartManager
|
|
restarting bool
|
|
processes map[string]*process
|
|
startedAt time.Time
|
|
}
|
|
|
|
// WithRestartManager sets the restartmanager to be used with the container.
|
|
func WithRestartManager(rm restartmanager.RestartManager) CreateOption {
|
|
return restartManager{rm}
|
|
}
|
|
|
|
type restartManager struct {
|
|
rm restartmanager.RestartManager
|
|
}
|
|
|
|
func (rm restartManager) Apply(p interface{}) error {
|
|
if pr, ok := p.(*container); ok {
|
|
pr.restartManager = rm.rm
|
|
return nil
|
|
}
|
|
return fmt.Errorf("WithRestartManager option not supported for this client")
|
|
}
|