Skip to content

Commit

Permalink
added hardcoded pause between 5 calls
Browse files Browse the repository at this point in the history
This could help us from hitting the rate limits
  • Loading branch information
Bullrich committed Apr 15, 2024
1 parent d58386c commit 1127b7a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/github/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ export class RepositoryApi {
prs.push(...nodes);
hasNextPage = pageInfo.hasNextPage;
cursor = pageInfo.endCursor;
if(currentPage % 5 === 0){
this.logger.debug("Pausing for one minute to not hit secondary limits")
await new Promise<void>(resolve => setTimeout(() => resolve(), 60_000));
}
if (query.rateLimit.remaining < 300) {
const {resetAt} = query.rateLimit;
this.logger.info(`About to reach limit. Limit resets at ${resetAt}. Waiting for ${secondsToTime(resetAt)}`);
Expand Down

0 comments on commit 1127b7a

Please sign in to comment.