Skip to content

Commit

Permalink
lsrepo: continue fetching missing repo in case of error too
Browse files Browse the repository at this point in the history
  • Loading branch information
hullarb committed May 20, 2019
1 parent 175ddb5 commit 9a799e6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lsrepo/main.go
Expand Up @@ -90,15 +90,18 @@ func fetchMissing(repoFiles []string) {
continue
}
log.Printf("fetching missing: %s", r.GetFullName())
for {
stop := false
for !stop {
rp, resp, err := client.Repositories.Get(context.Background(), r.GetOwner().GetLogin(), r.GetName())
if err != nil {
if _, ok := err.(*github.RateLimitError); ok {
log.Println("hit rate limit")
time.Sleep(10 * time.Second)
continue
} else {
log.Fatalf("failed to fetch %s: %v", r.GetFullName(), err)
log.Printf("failed to fetch %s: %v", r.GetFullName(), err)
stop = true
continue
}
}
if _, err = out.Write([]byte{',', '\n'}); err != nil {
Expand Down

0 comments on commit 9a799e6

Please sign in to comment.