Skip to content

Commit 177689a

Browse files
committed
Handle transient GraphQL responses without data
1 parent afebb20 commit 177689a

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

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)