Skip to content

Commit 1e5891e

Browse files
committed
Separate CTS for outer loop and short probe request
1 parent 9604b57 commit 1e5891e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/SeqCli.EndToEnd/Support/CliCommandRunner.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,19 @@ static async Task WaitForForwarderConnectionAsync(string forwarderApiListenUri)
5555

5656
while (true)
5757
{
58+
cts.Token.ThrowIfCancellationRequested();
59+
5860
var content = new StringContent("", new MediaTypeHeaderValue("application/vnd.serilog.clef", "utf-8"));
5961

6062
try
6163
{
62-
var ingestionResult = await httpClient.PostAsync(ingestEndpoint, content, cts.Token);
64+
using var shortCts = CancellationTokenSource.CreateLinkedTokenSource(cts.Token);
65+
shortCts.CancelAfter(TimeSpan.FromSeconds(1));
66+
67+
var ingestionResult = await httpClient.PostAsync(ingestEndpoint, content, shortCts.Token);
6368
if (ingestionResult.IsSuccessStatusCode)
6469
return;
70+
6571
Log.Information("Waiting for forwarder API to become available; last result {StatusCode}", ingestionResult.StatusCode);
6672
}
6773
catch (Exception ex)

0 commit comments

Comments
 (0)