Skip to content

Commit b0b45a3

Browse files
authored
Merge pull request #1 from ePlus-DEV/codex/fix-daily_update-job-failure
Handle transient GraphQL responses without data in daily update
2 parents afebb20 + 177689a commit b0b45a3

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

github/github.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,18 @@ Pages:
160160
dataNode, ok := rootNode["data"].(map[string]interface{})
161161
if !ok {
162162
retryCount++
163-
if retryCount < maxRetryCount {
163+
errorMsg := strPropOrEmpty(rootNode, "message")
164+
if errorMsg != "" {
165+
log.Printf("Error accessing data element. Message: %s", errorMsg)
166+
} else {
164167
log.Println("Error accessing data element")
165-
time.Sleep(10 * time.Second)
168+
}
169+
if retryCount < maxRetryCount {
170+
waitDuration := 10 * time.Second
171+
if strings.Contains(strings.ToLower(errorMsg), "secondary rate limit") {
172+
waitDuration = 65 * time.Second
173+
}
174+
time.Sleep(waitDuration)
166175
continue Pages
167176
} else {
168177
log.Fatalln("Too many errors received. Quitting.")

0 commit comments

Comments
 (0)