Skip to content

Commit c26f1ff

Browse files
committed
add check for rateLimiTotalMonth == 0
1 parent 60429b4 commit c26f1ff

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/sources/postman/postman_client.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,11 @@ func (c *Client) handleRateLimits(ctx trContext.Context, resp *http.Response) er
345345
return nil
346346
}
347347

348+
if rateLimitTotalMonth == 0 {
349+
ctx.Logger().V(2).Info("RateLimit-Limit-Month is zero, cannot compute usage percentage")
350+
return nil
351+
}
352+
348353
// failsafe to abandon scan if we are over the threshold of monthly API requests used
349354
percentageUsed := float64(rateLimitTotalMonth-rateLimitRemainingMonth) / float64(rateLimitTotalMonth)
350355
if percentageUsed > abortScanAPIReqLimitThreshold {

0 commit comments

Comments
 (0)