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