@@ -139,6 +139,7 @@ const TARGET_API_URL = process.env.TARGET_API_URL || 'https://api.github.com';
139139// by intercepting HTTP 403 responses and retry-after headers
140140const throttleOptions = {
141141 onRateLimit : ( retryAfter , options , octokit ) => {
142+ primaryRateLimitHits ++ ;
142143 warn ( `Primary rate limit exhausted for request ${ options . method } ${ options . url } ` ) ;
143144 if ( options . request . retryCount <= 2 ) {
144145 warn ( `Retrying after ${ retryAfter } seconds (retry ${ options . request . retryCount + 1 } /3)` ) ;
@@ -148,6 +149,7 @@ const throttleOptions = {
148149 return false ;
149150 } ,
150151 onSecondaryRateLimit : ( retryAfter , options , octokit ) => {
152+ secondaryRateLimitHits ++ ;
151153 warn ( `Secondary rate limit detected for request ${ options . method } ${ options . url } ` ) ;
152154 if ( options . request . retryCount <= 2 ) {
153155 warn ( `Retrying after ${ retryAfter } seconds (retry ${ options . request . retryCount + 1 } /3)` ) ;
@@ -178,6 +180,8 @@ let createdDiscussions = 0;
178180let skippedDiscussions = 0 ;
179181let totalComments = 0 ;
180182let copiedComments = 0 ;
183+ let primaryRateLimitHits = 0 ;
184+ let secondaryRateLimitHits = 0 ;
181185
182186// Helper functions
183187function log ( message ) {
@@ -1245,6 +1249,8 @@ async function main() {
12451249 log ( `Discussions skipped: ${ skippedDiscussions } ` ) ;
12461250 log ( `Total comments found: ${ totalComments } ` ) ;
12471251 log ( `Comments copied: ${ copiedComments } ` ) ;
1252+ log ( `Primary rate limits hit: ${ primaryRateLimitHits } ` ) ;
1253+ log ( `Secondary rate limits hit: ${ secondaryRateLimitHits } ` ) ;
12481254
12491255 if ( missingCategories . length > 0 ) {
12501256 warn ( "\nThe following categories were missing and need to be created manually:" ) ;
0 commit comments