From 46a1842665ff603457ea0766b3aec8852454b342 Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Wed, 14 Dec 2016 00:45:54 -0500 Subject: [PATCH 1/2] added backoff to fetch yaml file --- remote/remote.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/remote/remote.go b/remote/remote.go index d1ba29785..db433c93c 100644 --- a/remote/remote.go +++ b/remote/remote.go @@ -4,6 +4,7 @@ package remote import ( "net/http" + "time" "github.com/drone/drone/model" @@ -107,8 +108,15 @@ func Perm(c context.Context, u *model.User, owner, repo string) (*model.Perm, er } // File fetches a file from the remote repository and returns in string format. -func File(c context.Context, u *model.User, r *model.Repo, b *model.Build, f string) ([]byte, error) { - return FromContext(c).File(u, r, b, f) +func File(c context.Context, u *model.User, r *model.Repo, b *model.Build, f string) (out []byte, err error) { + for i:=0;i<5;i++ { + out, err = FromContext(c).File(u, r, b, f) + if err == nil { + return + } + time.Sleep(500*time.Millisecond) + } + return } // Status sends the commit status to the remote system. From 24c97c4f1d4120fa2c36aa22d84ed8b47c2a9e45 Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Wed, 14 Dec 2016 00:49:22 -0500 Subject: [PATCH 2/2] increased to 5sec --- remote/remote.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/remote/remote.go b/remote/remote.go index db433c93c..aac6aa53a 100644 --- a/remote/remote.go +++ b/remote/remote.go @@ -114,7 +114,7 @@ func File(c context.Context, u *model.User, r *model.Repo, b *model.Build, f str if err == nil { return } - time.Sleep(500*time.Millisecond) + time.Sleep(1*time.Second) } return }