Skip to content

Commit f3a715e

Browse files
authored
Merge pull request piceaTech#113 from AgnostiqHQ/throttling
Throttling mechanism to manage content creation abuse rate limit
2 parents ca30842 + 4ffadeb commit f3a715e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { default as readlineSync } from 'readline-sync';
1515
import * as fs from 'fs';
1616

1717
import AWS from 'aws-sdk';
18-
import { sleep } from './utils';
1918

2019
const counters = {
2120
nrOfPlaceholderIssues: 0,
@@ -68,16 +67,17 @@ const githubApi = new MyOctokit({
6867
console.log(
6968
`Request quota exhausted for request ${options.method} ${options.url}`
7069
);
71-
await sleep(60000);
70+
console.log(`Retrying after ${retryAfter} seconds!`);
7271
return true;
7372
},
7473
onAbuseLimit: async (retryAfter, options) => {
7574
console.log(
7675
`Abuse detected for request ${options.method} ${options.url}`
7776
);
78-
await sleep(60000);
77+
console.log(`Retrying after ${retryAfter} seconds!`);
7978
return true;
8079
},
80+
minimumAbuseRetryAfter: 1000,
8181
},
8282
});
8383

0 commit comments

Comments
 (0)