Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sleeping between PR creations #15

Merged
merged 1 commit into from
Jan 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/createPullRequest.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { size, map, get } = require('lodash/fp');
const { parseErrorToReadableJSON } = require('./dataTransformations');
const { parseErrorToReadableJSON, sleep } = require('./dataTransformations');
const { inspect } = require('util');

const createPullRquest = async (octokit, orgId, allOrgRepos) => {
Expand All @@ -13,6 +13,7 @@ const createPullRquest = async (octokit, orgId, allOrgRepos) => {
// Must run file creation in series due to the common use of the octokit instantiation
for (const pullRequestCreationFunction of pullRequestCreationFunctions) {
await pullRequestCreationFunction();
await sleep(5000)
}
};
const getPullRequestCreationFunction =
Expand Down
5 changes: 4 additions & 1 deletion src/dataTransformations.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ const encodeBase64 = (str) => str && Buffer.from(str).toString('base64');

const decodeBase64 = (str) => str && Buffer.from(str, 'base64').toString('ascii');

const sleep = async (ms = 2000) => new Promise((r) => setTimeout(r, ms));

module.exports = {
parseErrorToReadableJSON,
encodeBase64,
decodeBase64
decodeBase64,
sleep
};