mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-02-02 04:32:23 +00:00
added backoff to fetch yaml file
This commit is contained in:
parent
5abb5de44a
commit
46a1842665
1 changed files with 10 additions and 2 deletions
|
@ -4,6 +4,7 @@ package remote
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/drone/drone/model"
|
"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.
|
// 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) {
|
func File(c context.Context, u *model.User, r *model.Repo, b *model.Build, f string) (out []byte, err error) {
|
||||||
return FromContext(c).File(u, r, b, f)
|
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.
|
// Status sends the commit status to the remote system.
|
||||||
|
|
Loading…
Reference in a new issue