This commit is contained in:
Paul Dorsch 2024-06-24 14:27:37 -04:00 коммит произвёл GitHub
Родитель c20c3b0f56
Коммит cf13ef1b10
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
1 изменённых файлов: 6 добавлений и 2 удалений

Просмотреть файл

@ -269,7 +269,9 @@ public class DetectorProcessingService : IDetectorProcessingService
/// <summary>
/// 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.
/// </summary>
/// <param name="settingsTimeoutSeconds">Number of seconds before the detection process times out.</param>
/// <param name="isExperimental">Whether we should get the experimental timeout or not.</param>
@ -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)