diff --git a/src/Microsoft.ComponentDetection.Orchestrator/Services/DetectorProcessingService.cs b/src/Microsoft.ComponentDetection.Orchestrator/Services/DetectorProcessingService.cs index e1f902ff..f802443c 100644 --- a/src/Microsoft.ComponentDetection.Orchestrator/Services/DetectorProcessingService.cs +++ b/src/Microsoft.ComponentDetection.Orchestrator/Services/DetectorProcessingService.cs @@ -269,7 +269,9 @@ public class DetectorProcessingService : IDetectorProcessingService /// /// Gets the timeout for the individual running process. This is calculated based on /// whether we want the experimental timeout or not. Regardless, we will take a buffer of 5 seconds off of - /// the timeout value so that the process has time to exit before the invoking process is cancelled. + /// the timeout value so that the process has time to exit before the invoking process is cancelled. If the timeout is + /// set to less than 5 seconds, we set the process timeout to 1 second prior, since the CLI rejects any timeouts + /// less than 1. /// /// Number of seconds before the detection process times out. /// Whether we should get the experimental timeout or not. @@ -280,7 +282,9 @@ public class DetectorProcessingService : IDetectorProcessingService ? Math.Min(settingsTimeoutSeconds, ExperimentalTimeoutSeconds) : settingsTimeoutSeconds; - return TimeSpan.FromSeconds(timeoutSeconds - ProcessTimeoutBufferSeconds); + return timeoutSeconds > ProcessTimeoutBufferSeconds + ? TimeSpan.FromSeconds(timeoutSeconds - ProcessTimeoutBufferSeconds) + : TimeSpan.FromSeconds(timeoutSeconds - 1); } private IndividualDetectorScanResult CoalesceResult(IndividualDetectorScanResult individualDetectorScanResult)