File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -225,14 +225,10 @@ function Invoke-OpenAIAPIRequestSSE {
225225
226226 # Note:
227227 # In some situations, the server may unilaterally close the connection without sending any data.
228- # To avoid long blocking waits that prevent user cancellation, we use a polling interval.
229- # We allow a maximum total wait of 30 seconds while checking for cancellation every 500 ms.
230- $timeoutMs = 30000
228+ # To avoid long blocking waits that prevent user cancellation, check for cancellation every 500 ms.
231229 $pollInterval = 500 # milliseconds
232- $stopwatch = [System.Diagnostics.Stopwatch ]::StartNew()
233-
234230 $readTask = $StreamReader.ReadLineAsync ()
235- while (-not $CancelToken.IsCancellationRequested -and $stopwatch .ElapsedMilliseconds -lt $timeoutMs ) {
231+ while (-not $CancelToken.IsCancellationRequested ) {
236232 if ($readTask.Wait ($pollInterval , $CancelToken )) {
237233 break
238234 }
You can’t perform that action at this time.
0 commit comments