Skip to content

Commit 74a9d33

Browse files
Fix polling timeout: use linked cancellation token in poll loop
The CancellationTokenSource with timeout was created but the loop and Task.Delay used the original token instead, causing infinite polling when ingestion status never reached a terminal state.
1 parent c9814ad commit 74a9d33

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Services/IKustoIngestionService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ protected static async Task<IngestionStatus> PollIngestionStatus(IKustoIngestion
5757
var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
5858
cts.CancelAfter(TimeSpan.FromMinutes(ingestionTimeoutMinutes));
5959
IngestionStatus ingestionStatus = null;
60-
while (!cancellationToken.IsCancellationRequested)
60+
while (!cts.Token.IsCancellationRequested)
6161
{
6262
ingestionStatus = queuedIngestResult.GetIngestionStatusBySourceId(sourceId);
6363
if (ingestionStatus.Status == Status.Succeeded
@@ -67,7 +67,7 @@ protected static async Task<IngestionStatus> PollIngestionStatus(IKustoIngestion
6767
{
6868
break;
6969
}
70-
await Task.Delay(TimeSpan.FromSeconds(pollIntervalSeconds), cancellationToken);
70+
await Task.Delay(TimeSpan.FromSeconds(pollIntervalSeconds), cts.Token);
7171
}
7272
return ingestionStatus;
7373
}

0 commit comments

Comments
 (0)