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);