Merge pull request #21993 from coolljt0725/quiet_restartmanger_cancel
Don't throw "restartmanager canceled" error for no restart policy container
This commit is contained in:
commit
a4030787f5
|
@ -120,7 +120,7 @@ func (ctr *container) handleEvent(e *containerd.Event) error {
|
||||||
if st.State == StateExit && ctr.restartManager != nil {
|
if st.State == StateExit && ctr.restartManager != nil {
|
||||||
restart, wait, err := ctr.restartManager.ShouldRestart(e.Status, false)
|
restart, wait, err := ctr.restartManager.ShouldRestart(e.Status, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Error(err)
|
logrus.Warnf("container %s %v", ctr.containerID, err)
|
||||||
} else if restart {
|
} else if restart {
|
||||||
st.State = StateRestart
|
st.State = StateRestart
|
||||||
ctr.restarting = true
|
ctr.restarting = true
|
||||||
|
|
|
@ -42,6 +42,9 @@ func (rm *restartManager) SetPolicy(policy container.RestartPolicy) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rm *restartManager) ShouldRestart(exitCode uint32, hasBeenManuallyStopped bool) (bool, chan error, error) {
|
func (rm *restartManager) ShouldRestart(exitCode uint32, hasBeenManuallyStopped bool) (bool, chan error, error) {
|
||||||
|
if rm.policy.IsNone() {
|
||||||
|
return false, nil, nil
|
||||||
|
}
|
||||||
rm.Lock()
|
rm.Lock()
|
||||||
unlockOnExit := true
|
unlockOnExit := true
|
||||||
defer func() {
|
defer func() {
|
||||||
|
|
Loading…
Reference in New Issue