|
27 | 27 |
|
28 | 28 | // Configuration |
29 | 29 | const INCLUDE_POLL_MERMAID_CHART = true; // Set to false to disable Mermaid pie chart for polls |
30 | | -const RATE_LIMIT_SLEEP_SECONDS = 2; // Default sleep duration between API calls to avoid rate limiting |
| 30 | +const RATE_LIMIT_SLEEP_SECONDS = 0.5; // Default sleep duration between API calls to avoid rate limiting |
| 31 | +const DISCUSSION_PROCESSING_DELAY_SECONDS = 5; // Delay between processing discussions |
31 | 32 |
|
32 | 33 | const { Octokit } = require("octokit"); |
33 | 34 |
|
@@ -693,7 +694,7 @@ async function createDiscussion(octokit, repositoryId, categoryId, title, body, |
693 | 694 |
|
694 | 695 | log(`Creating discussion: '${title}'`); |
695 | 696 |
|
696 | | - await rateLimitSleep(3); |
| 697 | + await rateLimitSleep(); |
697 | 698 |
|
698 | 699 | try { |
699 | 700 | const response = await octokit.graphql(CREATE_DISCUSSION_MUTATION, { |
@@ -924,7 +925,7 @@ async function copyDiscussionComments(octokit, discussionId, comments, answerCom |
924 | 925 | async function processDiscussionsPage(sourceOctokit, targetOctokit, owner, repo, targetRepoId, targetCategories, targetLabels, cursor = null) { |
925 | 926 | log(`Fetching discussions page (cursor: ${cursor || "null"})...`); |
926 | 927 |
|
927 | | - await rateLimitSleep(3); |
| 928 | + await rateLimitSleep(); |
928 | 929 |
|
929 | 930 | try { |
930 | 931 | const response = await sourceOctokit.graphql(FETCH_DISCUSSIONS_QUERY, { |
@@ -1050,7 +1051,7 @@ async function processDiscussionsPage(sourceOctokit, targetOctokit, owner, repo, |
1050 | 1051 | log(`✅ Finished processing discussion #${discussion.number}: '${discussion.title}'`); |
1051 | 1052 |
|
1052 | 1053 | // Delay between discussions |
1053 | | - await sleep(5); |
| 1054 | + await sleep(DISCUSSION_PROCESSING_DELAY_SECONDS); |
1054 | 1055 |
|
1055 | 1056 | } catch (err) { |
1056 | 1057 | error(`Failed to create discussion #${discussion.number}: '${discussion.title}' - ${err.message}`); |
|
0 commit comments