-
Notifications
You must be signed in to change notification settings - Fork 119
Add cancellation token parameter to async feature management interfaces. #131
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ | |
| using System.Collections.Concurrent; | ||
| using System.Collections.Generic; | ||
| using System.Linq; | ||
| using System.Runtime.CompilerServices; | ||
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
|
|
||
|
|
@@ -40,7 +41,7 @@ public void Dispose() | |
| _changeSubscription = null; | ||
| } | ||
|
|
||
| public Task<FeatureDefinition> GetFeatureDefinitionAsync(string featureName) | ||
| public Task<FeatureDefinition> GetFeatureDefinitionAsync(string featureName, CancellationToken _) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe better to have a proper parameter name like
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree. I think the intent of using a discard here to indicate synchronous completion doesn't really fit will. I'll send a PR to update. |
||
| { | ||
| if (featureName == null) | ||
| { | ||
|
|
@@ -63,7 +64,7 @@ public Task<FeatureDefinition> GetFeatureDefinitionAsync(string featureName) | |
| // The async key word is necessary for creating IAsyncEnumerable. | ||
| // The need to disable this warning occurs when implementaing async stream synchronously. | ||
| #pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously | ||
| public async IAsyncEnumerable<FeatureDefinition> GetAllFeatureDefinitionsAsync() | ||
| public async IAsyncEnumerable<FeatureDefinition> GetAllFeatureDefinitionsAsync([EnumeratorCancellation] CancellationToken _) | ||
| #pragma warning restore CS1998 | ||
| { | ||
| if (Interlocked.Exchange(ref _stale, 0) != 0) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.