@@ -101,13 +101,6 @@ public class MvnCliComponentDetector : FileComponentDetector
101101 @"https?://[^\s\]\)>]+" ,
102102 RegexOptions . Compiled | RegexOptions . IgnoreCase ) ;
103103
104- /// <summary>
105- /// Maximum time allowed for the OnPrepareDetectionAsync phase.
106- /// This is a safety guardrail to prevent hangs.
107- /// Most repos should complete the full Maven CLI scan within this window.
108- /// </summary>
109- private static readonly TimeSpan PrepareDetectionTimeout = TimeSpan . FromMinutes ( 5 ) ;
110-
111104 private readonly IMavenCommandService mavenCommandService ;
112105 private readonly IEnvironmentVariableService envVarService ;
113106 private readonly IFileUtilityService fileUtilityService ;
@@ -298,20 +291,13 @@ protected override async Task<IObservable<ProcessRequest>> OnPrepareDetectionAsy
298291 // This is critical because detectors are registered as singletons
299292 this . ResetScanState ( ) ;
300293
301- // Wrap the entire method in a try-catch with timeout to protect against hangs.
302- // OnPrepareDetectionAsync doesn't have the same guardrails as OnFileFoundAsync,
303- // so we need to be extra careful here.
304294 try
305295 {
306- using var timeoutCts = new CancellationTokenSource ( PrepareDetectionTimeout ) ;
307- using var linkedCts = CancellationTokenSource . CreateLinkedTokenSource ( cancellationToken , timeoutCts . Token ) ;
308-
309- return await this . OnPrepareDetectionCoreAsync ( processRequests , linkedCts . Token ) ;
296+ return await this . OnPrepareDetectionCoreAsync ( processRequests , cancellationToken ) ;
310297 }
311- catch ( OperationCanceledException ) when ( ! cancellationToken . IsCancellationRequested )
298+ catch ( OperationCanceledException )
312299 {
313- // Timeout occurred (not user cancellation)
314- this . LogWarning ( $ "OnPrepareDetectionAsync timed out after { PrepareDetectionTimeout . TotalMinutes } minutes. Falling back to static pom.xml parsing.") ;
300+ this . LogWarning ( "OnPrepareDetectionAsync was cancelled. Falling back to static pom.xml parsing." ) ;
315301 this . Telemetry [ "TimedOut" ] = "true" ;
316302 this . fallbackReason = MavenFallbackReason . OtherMvnCliFailure ;
317303 this . usedDetectionMethod = MavenDetectionMethod . Mixed ;
0 commit comments