now retrying to get commits

Signed-off-by: Hadi <[email protected]>
This commit is contained in:
Hadi
2025-09-17 21:07:16 +02:00
parent 98769561c3
commit dab0ba2b38
+9 -2
View File
@@ -2,6 +2,7 @@ package recon
import ( import (
"math/rand" "math/rand"
"time"
github_recon_settings "github.com/anotherhadi/github-recon/settings" github_recon_settings "github.com/anotherhadi/github-recon/settings"
"github.com/anotherhadi/github-recon/utils" "github.com/anotherhadi/github-recon/utils"
@@ -99,6 +100,9 @@ func Spoofing(s github_recon_settings.Settings) (response *SpoofingResult) {
} }
utils.WaitForRateLimit(s, resp) utils.WaitForRateLimit(s, resp)
const maxRetries = 5
const retryDelay = 2 * time.Second
for i := 0; i < maxRetries; i++ {
commits, _, err := s.Client.Repositories.ListCommits(s.Ctx, repo.Owner.GetLogin(), name, nil) commits, _, err := s.Client.Repositories.ListCommits(s.Ctx, repo.Owner.GetLogin(), name, nil)
if err != nil { if err != nil {
s.Logger.Error("Error while listing commits", "err", err) s.Logger.Error("Error while listing commits", "err", err)
@@ -112,8 +116,11 @@ func Spoofing(s github_recon_settings.Settings) (response *SpoofingResult) {
response.Email = last.GetAuthor().GetEmail() response.Email = last.GetAuthor().GetEmail()
response.Url = last.GetAuthor().GetHTMLURL() response.Url = last.GetAuthor().GetHTMLURL()
response.AvatarURL = last.GetAuthor().GetAvatarURL() response.AvatarURL = last.GetAuthor().GetAvatarURL()
} else { break
s.Logger.Error("Only one commit found, something went wrong.", "commits", commits) }
s.Logger.Info("Only one commit found, retrying...", "attempt", i+1)
time.Sleep(retryDelay)
} }
if response.Username == "" && response.Name == "" && response.Email == "" { if response.Username == "" && response.Name == "" && response.Email == "" {