Skip to content

Propagate cancellation tokens through data store persistence - #5744

Merged
johnsimons merged 6 commits into
john/cancel_part11from
john/cancel_part12
Aug 12, 2026
Merged

johnsimons merged 6 commits into
john/cancel_part11from
john/cancel_part12

Conversation

@johnsimons

Copy link
Copy Markdown
Member

Propagate cancellation tokens through licensing data store persistence.
Propagate cancellation tokens through remaining persistence data stores and lifecycle operations
Propagate cancellation tokens through endpoint settings, subscriptions and trial license persistence

@johnsimons
johnsimons requested a review from rbev August 11, 2026 23:22
@johnsimons johnsimons self-assigned this Aug 11, 2026
}
#pragma warning disable PS0019 // The filter already excludes OperationCanceledException, so
// cancellation propagates; PS0019 only recognises a cancellationToken guard.
catch (Exception ex) when (ex is not OperationCanceledException)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you avoid the pragma by doing

Suggested change
catch (Exception ex) when (ex is not OperationCanceledException)
catch (Exception ex) when (ex is not OperationCanceledException && cancellationToken.IsCancellationRequested)

Also it probably wants to log cancellation exceptions that are not related to the current token

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our analyser seems to be very picky and always wants catch (OperationCanceledException ex) when (cancellationToken.IsCancellationRequested).
So any deviation from that causes a warning.

This change continues the effort to consistently apply optional `CancellationToken` parameters to asynchronous methods within the `IMonitoringDataStore` interface, its EFCore and RavenDB implementations, and the controllers, handlers, and services that consume them.

Cancellation tokens are now propagated to underlying asynchronous database calls, ensuring proper cancellation of long-running operations and further reducing cancellation analyzer debt.
…s and trial license persistence

This change continues the effort to consistently apply optional `CancellationToken` parameters to asynchronous methods within the `IEndpointSettingsStore`, `IServiceControlSubscriptionStorage`, and `ITrialLicenseDataProvider` interfaces, along with their EFCore and RavenDB implementations.

Cancellation tokens are now propagated to underlying asynchronous database calls, ensuring proper cancellation of long-running operations and further reducing cancellation analyzer debt.
…es and lifecycle operations

This change continues the effort to consistently apply optional `CancellationToken` parameters to asynchronous methods across the remaining persistence interfaces and lifecycle operations, along with their EFCore and RavenDB implementations.

Cancellation tokens are now propagated to underlying asynchronous database calls and lifecycle hooks, ensuring proper responsiveness to cancellation. This work retires the majority of cancellation analyzer suppressions across the persistence projects, leaving only the licensing data store—which belongs to the licensing phase—as an accepted exception.
This change continues the effort to consistently apply optional `CancellationToken` parameters to asynchronous methods within the `ILicensingDataStore` interface, along with its In-Memory, EFCore, and RavenDB implementations.

Cancellation tokens are now propagated to underlying asynchronous database calls, ensuring proper responsiveness to cancellation and retiring the remaining cancellation analyzer debt for these projects.
…s check

This change removes a redundant comment explaining the PS0020 analyzer suppression within the RavenDB licensing status check, continuing the effort to clean up cancellation-related debt.
… persistence

This change continues the effort to consistently apply optional `CancellationToken` parameters to asynchronous methods within the `IFailedMessageRetryDataStore` EFCore implementation.

Cancellation tokens are now propagated to underlying asynchronous database calls, ensuring proper responsiveness to cancellation and further reducing cancellation analyzer debt.
@johnsimons
johnsimons merged commit 0f813d9 into master Aug 12, 2026
50 checks passed
@johnsimons
johnsimons deleted the john/cancel_part12 branch August 12, 2026 04:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants