From 3b8b18fdca53d240a5548e63a797356f0cbd3d7e Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Mon, 24 Aug 2015 12:29:08 -0700 Subject: [PATCH] added a backoff for streaming output --- pkg/runner/builtin/runner.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/runner/builtin/runner.go b/pkg/runner/builtin/runner.go index 3ed76b2a..f233ae1f 100644 --- a/pkg/runner/builtin/runner.go +++ b/pkg/runner/builtin/runner.go @@ -257,7 +257,17 @@ func (r *Runner) Logs(job *types.Job) (io.ReadCloser, error) { // make sure this container actually exists info, err := client.InspectContainer(cname(job)) if err != nil { - return nil, err + // add a small exponential backoff since there + // is a small window when the container hasn't + // been created yet, but the build is about to start + for i := 0; ; i++ { + time.Sleep(1 * time.Second) + info, err = client.InspectContainer(cname(job)) + if err != nil && i == 5 { + return nil, err + } + break + } } // verify the container is running. if not we'll