Skip to content

Commit

Permalink
move error see if it solves issues
Browse files Browse the repository at this point in the history
  • Loading branch information
codeliger committed Dec 19, 2023
1 parent b454272 commit 56a6b4b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,17 @@ func getRepoDataFromGithub(client *github.Client, rateLimit *atomic.Int32, wg *s

repo, _, err := client.Repositories.Get(context.Background(), markdownRepo.OwnerName, markdownRepo.RepoName)
if err != nil {
if strings.Contains(err.Error(), "secondary") {
fmt.Println("secondary rate limit reached, sleeping for 3 seconds")
time.Sleep(3 * time.Second)

markdownRepoChan <- markdownRepo
continue
}
if rateLimitErr, ok := err.(*github.RateLimitError); ok {
fmt.Println("repo function returned ratelimit error")
rateLimit.Store(int32(rateLimitErr.Rate.Remaining))
if strings.Contains(rateLimitErr.Message, "secondary") {
fmt.Println("secondary rate limit reached, sleeping for 3 seconds")
time.Sleep(3 * time.Second)
}

markdownRepoChan <- markdownRepo
continue
}
Expand Down

0 comments on commit 56a6b4b

Please sign in to comment.