Skip to content
This repository has been archived by the owner on Jan 23, 2025. It is now read-only.

Commit

Permalink
feat: delay by default (#568)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoe authored Jan 15, 2022
1 parent fb053fd commit 2e522e4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/lib/asyncItemIterator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ async function process(
: 15;
// Introduce a delay between requests, this may be necessary if
// processing many repos in a row to avoid rate limits:
const delay: number = cli.flags.delay ? Number(cli.flags.delay) : 0;
const delay: number = cli.flags.delay ? Number(cli.flags.delay) : 500;
const retry: boolean = cli.flags.retry ? Boolean(cli.flags.retry) : false;
const config = await configLib.getConfig();
const retryStrategy = retry
Expand Down Expand Up @@ -187,12 +187,12 @@ async function process(
let localItems;
if (processIssues) {
localItems = await retryException<Issue[]>(async () => {
if (delay) delayMs(delay);
if (delay) delayMs(nextDelay(delay));
return await repo.listIssues();
}, retryStrategy);
} else {
localItems = await retryException<PullRequest[]>(async () => {
if (delay) delayMs(delay);
if (delay) delayMs(nextDelay(delay));
return await repo.listPullRequests();
}, retryStrategy);
}
Expand Down Expand Up @@ -266,7 +266,7 @@ async function process(
if (processIssues) {
const opts = options as IssueIteratorOptions;
result = await retryBoolean(async () => {
if (delay) await delayMs(delay);
if (delay) await delayMs(nextDelay(delay));
return await opts.processMethod(
itemSet.repo,
itemSet.item as Issue,
Expand All @@ -276,7 +276,7 @@ async function process(
} else {
const opts = options as PRIteratorOptions;
result = await retryBoolean(async () => {
if (delay) await delayMs(delay);
if (delay) await delayMs(nextDelay(delay));
return await opts.processMethod(
itemSet.repo,
itemSet.item as PullRequest,
Expand Down

0 comments on commit 2e522e4

Please sign in to comment.