File tree Expand file tree Collapse file tree 2 files changed +35
-6
lines changed Expand file tree Collapse file tree 2 files changed +35
-6
lines changed Original file line number Diff line number Diff line change @@ -284,7 +284,25 @@ export class GithubRepositoryService {
284284 factor : 2 ,
285285 onRetry : ( error : any , attempt : number ) => {
286286 const status = error . status || error . response ?. status ;
287- const isRetryable = status === 429 || ( status >= 500 && status < 600 ) ;
287+ const errorCode = error . code ;
288+
289+ // Check for retryable HTTP status codes
290+ const isHttpRetryable = status === 429 || ( status >= 500 && status < 600 ) ;
291+
292+ // Check for retryable transport error codes
293+ const retryableTransportCodes = [
294+ 'ETIMEDOUT' ,
295+ 'ECONNRESET' ,
296+ 'ENOTFOUND' ,
297+ 'EAI_AGAIN' ,
298+ 'ECONNREFUSED' ,
299+ 'EHOSTUNREACH' ,
300+ 'ENETUNREACH' ,
301+ 'ETIMEOUT'
302+ ] ;
303+ const isTransportRetryable = errorCode && retryableTransportCodes . includes ( errorCode ) ;
304+
305+ const isRetryable = isHttpRetryable || isTransportRetryable ;
288306
289307 if ( isRetryable ) {
290308 defaultLogger . warn ( {
@@ -294,8 +312,9 @@ export class GithubRepositoryService {
294312 path : trimmedPath ,
295313 attempt,
296314 status,
315+ errorCode,
297316 error : error . message
298- } , `Retrying file deletion (attempt ${ attempt } /3) - Status: ${ status } ` ) ;
317+ } , `Retrying file deletion (attempt ${ attempt } /3) - Status: ${ status } , Code: ${ errorCode } ` ) ;
299318 } else {
300319 // Non-retryable error, throw immediately
301320 throw error ;
Original file line number Diff line number Diff line change @@ -329,10 +329,20 @@ export class GitLabClient implements IGitLabCoreClient {
329329 try {
330330 const tree = await retry (
331331 async ( ) => {
332- return await this . client . Repositories . allRepositoryTrees ( projectId , {
333- path : trimmedPath ,
334- ref : trimmedBranch ,
335- } ) ;
332+ try {
333+ return await this . client . Repositories . allRepositoryTrees ( projectId , {
334+ path : trimmedPath ,
335+ ref : trimmedBranch ,
336+ } ) ;
337+ } catch ( error : any ) {
338+ // Check if error is 404 - don't retry on 404 errors
339+ if ( error . response ?. status === 404 || error . status === 404 || error . message ?. includes ( '404' ) ) {
340+ // Rethrow 404 errors immediately to prevent retries
341+ throw error ;
342+ }
343+ // For all other errors, rethrow to let retry mechanism handle them
344+ throw error ;
345+ }
336346 } ,
337347 {
338348 retries : 3 ,
You can’t perform that action at this time.
0 commit comments