fixup! refactor(container): restart handling

This commit is contained in:
Rob Watson 2025-04-13 09:49:41 +02:00
parent c999e418f5
commit d65fca0afe

View File

@ -403,7 +403,6 @@ func (a *Client) runContainerLoop(
restartCount: restartCount, restartCount: restartCount,
} }
case <-timer.C: case <-timer.C:
fmt.Println("ContainerWait timer expired")
a.logger.Info("Container restarting", "id", shortID(containerID), "restart_count", restartCount) a.logger.Info("Container restarting", "id", shortID(containerID), "restart_count", restartCount)
restartCount++ restartCount++
if err := a.apiClient.ContainerStart(ctx, containerID, container.StartOptions{}); err != nil { if err := a.apiClient.ContainerStart(ctx, containerID, container.StartOptions{}); err != nil {
@ -412,11 +411,9 @@ func (a *Client) runContainerLoop(
} }
a.logger.Info("Restarted container", "id", shortID(containerID)) a.logger.Info("Restarted container", "id", shortID(containerID))
case err := <-errC: case err := <-errC:
fmt.Println("ContainerWait error", err)
containerErrC <- err containerErrC <- err
return return
case <-ctx.Done(): case <-ctx.Done():
fmt.Println("ContainerWait cancelled")
// This is probably because the container was stopped. // This is probably because the container was stopped.
containerRespC <- containerWaitResponse{WaitResponse: container.WaitResponse{}, restarting: false} containerRespC <- containerWaitResponse{WaitResponse: container.WaitResponse{}, restarting: false}
return return