From a4d19fa3e22c21981977a00321c0d7175c4c7f02 Mon Sep 17 00:00:00 2001 From: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> Date: Tue, 13 Feb 2024 09:33:04 -0800 Subject: [PATCH] Pass linked token to trigger execution (#41921) --- .../src/Listeners/EventHubListener.PartitionProcessor.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/src/Listeners/EventHubListener.PartitionProcessor.cs b/sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/src/Listeners/EventHubListener.PartitionProcessor.cs index c5fad348ed78e..a2f1c58036d23 100644 --- a/sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/src/Listeners/EventHubListener.PartitionProcessor.cs +++ b/sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/src/Listeners/EventHubListener.PartitionProcessor.cs @@ -173,7 +173,7 @@ public async Task ProcessEventsAsync(EventProcessorHostPartition context, IEnume _logger.LogDebug($"Partition Processor received events and is attempting to invoke function ({details})"); UpdateCheckpointContext(triggerEvents, context); - await TriggerExecute(triggerEvents, context, _functionExecutionToken).ConfigureAwait(false); + await TriggerExecute(triggerEvents, context, linkedCts.Token).ConfigureAwait(false); eventToCheckpoint = triggerEvents.Last(); // If there is a background timer task, cancel it and dispose of the cancellation token. If there @@ -207,7 +207,7 @@ public async Task ProcessEventsAsync(EventProcessorHostPartition context, IEnume else { UpdateCheckpointContext(events, context); - await TriggerExecute(events, context, _functionExecutionToken).ConfigureAwait(false); + await TriggerExecute(events, context, linkedCts.Token).ConfigureAwait(false); eventToCheckpoint = events.LastOrDefault(); } @@ -286,7 +286,7 @@ private async Task MonitorCachedEvents(DateTimeOffset? lastCheckpointTime, Cance _logger.LogDebug($"Partition Processor has waited MaxWaitTime since last invocation and is attempting to invoke function on all held events ({details})"); UpdateCheckpointContext(triggerEvents, _mostRecentPartitionContext); - await TriggerExecute(triggerEvents, _mostRecentPartitionContext, _functionExecutionToken).ConfigureAwait(false); + await TriggerExecute(triggerEvents, _mostRecentPartitionContext, backgroundCancellationTokenSource.Token).ConfigureAwait(false); if (!backgroundCancellationTokenSource.Token.IsCancellationRequested) { await CheckpointAsync(triggerEvents.Last(), _mostRecentPartitionContext).ConfigureAwait(false);