-
Notifications
You must be signed in to change notification settings - Fork 49
Support cancellation of web api and audit storage operations #4782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c407a39
Support cancellation of audit ingestion
ramonsmits faaf0ef
Support cancellation for error ingestion
ramonsmits d836272
Added code comments on how lifetime is managed for `CancellationToken…
ramonsmits e9e7317
started undertaking adding support for cancellation in domain events …
ramonsmits 06cfbd8
More cancellation token propagation
ramonsmits 7fb0a01
OnMessage: Invoke `TrySetCanceled` when cancelled to return ASAP
ramonsmits e2e28a2
Fix API's are rebase with forcing accepting all changes from master
ramonsmits 2400885
Suggestion by feedback to pass CT's to RecordProcessedMessage, Record…
ramonsmits d5d6c3a
Fixes tests
ramonsmits 13fa363
Cancel OnMessage immediately IHostedService.StopAsync is invoked
ramonsmits 011ed4e
Alternative to previous commit, stop receviers and shutdown with alre…
ramonsmits 5e93c90
Add clarifying code comment on why a CancellationToken is passed in t…
ramonsmits 0589fba
More cancellation as test
ramonsmits 90694a2
APIApprovels HTTP API routes
ramonsmits File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 4 additions & 3 deletions
7
src/ServiceControl.Audit.Persistence/UnitOfWork/IAuditIngestionUnitOfWork.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,16 @@ | ||
| namespace ServiceControl.Audit.Persistence.UnitOfWork | ||
| { | ||
| using System; | ||
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
| using Auditing; | ||
| using Monitoring; | ||
| using ServiceControl.SagaAudit; | ||
|
|
||
| public interface IAuditIngestionUnitOfWork : IAsyncDisposable | ||
| { | ||
| Task RecordProcessedMessage(ProcessedMessage processedMessage, ReadOnlyMemory<byte> body = default); | ||
| Task RecordSagaSnapshot(SagaSnapshot sagaSnapshot); | ||
| Task RecordKnownEndpoint(KnownEndpoint knownEndpoint); | ||
| Task RecordProcessedMessage(ProcessedMessage processedMessage, ReadOnlyMemory<byte> body = default, CancellationToken cancellationToken = default); | ||
| Task RecordSagaSnapshot(SagaSnapshot sagaSnapshot, CancellationToken cancellationToken = default); | ||
| Task RecordKnownEndpoint(KnownEndpoint knownEndpoint, CancellationToken cancellationToken = default); | ||
| } | ||
| } |
3 changes: 2 additions & 1 deletion
3
src/ServiceControl.Audit.Persistence/UnitOfWork/IAuditIngestionUnitOfWorkFactory.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,11 @@ | ||
| namespace ServiceControl.Audit.Persistence.UnitOfWork | ||
| { | ||
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
|
|
||
| public interface IAuditIngestionUnitOfWorkFactory | ||
| { | ||
| ValueTask<IAuditIngestionUnitOfWork> StartNew(int batchSize); //Throws if not enough space or some other problem preventing from writing data | ||
| ValueTask<IAuditIngestionUnitOfWork> StartNew(int batchSize, CancellationToken cancellationToken); //Throws if not enough space or some other problem preventing from writing data | ||
| bool CanIngestMore(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.