fixup! refactor(container): restart handling
This commit is contained in:
parent
888aadbdc0
commit
7242534a10
@ -332,7 +332,7 @@ func (a *Client) runContainerLoop(
|
||||
containerID string,
|
||||
imageName string,
|
||||
networkCountConfig NetworkCountConfig,
|
||||
shouldRestart ShouldRestartFunc,
|
||||
shouldRestartFunc ShouldRestartFunc,
|
||||
stateC chan<- domain.Container,
|
||||
errC chan<- error,
|
||||
) {
|
||||
@ -366,8 +366,8 @@ func (a *Client) runContainerLoop(
|
||||
respC, errC := a.apiClient.ContainerWait(ctx, containerID, container.WaitConditionNextExit)
|
||||
select {
|
||||
case resp := <-respC:
|
||||
if shouldRestart != nil {
|
||||
shouldRestart, err := shouldRestart(resp.StatusCode, restartCount, time.Since(startedWaitingAt))
|
||||
if shouldRestartFunc != nil {
|
||||
shouldRestart, err := shouldRestartFunc(resp.StatusCode, restartCount, time.Since(startedWaitingAt))
|
||||
if shouldRestart && err != nil {
|
||||
panic(fmt.Errorf("shouldRestart must return nil error if restarting, but returned: %w", err))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user