Skip to content

Commit 77fc24b

Browse files
committed
Revert "Revert "Revert "Added default value for cancellation token in interfaces to keep existing usage possible. (#133)" (#138)""
This reverts commit d087e7b.
1 parent 8d59200 commit 77fc24b

17 files changed

+27
-27
lines changed

examples/ConsoleApp/FeatureFilters/AccountIdFilter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace Consoto.Banking.AccountService.FeatureManagement
1818
[FilterAlias("AccountId")]
1919
class AccountIdFilter : IContextualFeatureFilter<IAccountContext>
2020
{
21-
public Task<bool> EvaluateAsync(FeatureFilterEvaluationContext featureEvaluationContext, IAccountContext accountContext, CancellationToken cancellationToken)
21+
public Task<bool> EvaluateAsync(FeatureFilterEvaluationContext featureEvaluationContext, IAccountContext accountContext, CancellationToken _)
2222
{
2323
if (string.IsNullOrEmpty(accountContext?.AccountId))
2424
{

examples/FeatureFlagDemo/BrowserFilter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public BrowserFilter(IHttpContextAccessor httpContextAccessor)
2424
_httpContextAccessor = httpContextAccessor ?? throw new ArgumentNullException(nameof(httpContextAccessor));
2525
}
2626

27-
public Task<bool> EvaluateAsync(FeatureFilterEvaluationContext context, CancellationToken cancellationToken)
27+
public Task<bool> EvaluateAsync(FeatureFilterEvaluationContext context, CancellationToken _)
2828
{
2929
BrowserFilterSettings settings = context.Parameters.Get<BrowserFilterSettings>() ?? new BrowserFilterSettings();
3030

examples/FeatureFlagDemo/HttpContextTargetingContextAccessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public HttpContextTargetingContextAccessor(IHttpContextAccessor httpContextAcces
2424
_httpContextAccessor = httpContextAccessor ?? throw new ArgumentNullException(nameof(httpContextAccessor));
2525
}
2626

27-
public ValueTask<TargetingContext> GetContextAsync(CancellationToken cancellationToken)
27+
public ValueTask<TargetingContext> GetContextAsync(CancellationToken _)
2828
{
2929
HttpContext httpContext = _httpContextAccessor.HttpContext;
3030

examples/FeatureFlagDemo/SuperUserFilter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace FeatureFlagDemo.FeatureManagement.FeatureFilters
99
{
1010
public class SuperUserFilter : IFeatureFilter
1111
{
12-
public Task<bool> EvaluateAsync(FeatureFilterEvaluationContext context, CancellationToken cancellationToken)
12+
public Task<bool> EvaluateAsync(FeatureFilterEvaluationContext context, CancellationToken _)
1313
{
1414
return Task.FromResult(false);
1515
}

src/Microsoft.FeatureManagement/ConfigurationFeatureDefinitionProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public void Dispose()
4545
_changeSubscription = null;
4646
}
4747

48-
public Task<FeatureDefinition> GetFeatureDefinitionAsync(string featureName, CancellationToken cancellationToken)
48+
public Task<FeatureDefinition> GetFeatureDefinitionAsync(string featureName, CancellationToken _)
4949
{
5050
if (featureName == null)
5151
{
@@ -68,7 +68,7 @@ public Task<FeatureDefinition> GetFeatureDefinitionAsync(string featureName, Can
6868
// The async key word is necessary for creating IAsyncEnumerable.
6969
// The need to disable this warning occurs when implementaing async stream synchronously.
7070
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
71-
public async IAsyncEnumerable<FeatureDefinition> GetAllFeatureDefinitionsAsync([EnumeratorCancellation] CancellationToken cancellationToken)
71+
public async IAsyncEnumerable<FeatureDefinition> GetAllFeatureDefinitionsAsync([EnumeratorCancellation] CancellationToken _)
7272
#pragma warning restore CS1998
7373
{
7474
if (Interlocked.Exchange(ref _stale, 0) != 0)

src/Microsoft.FeatureManagement/EmptySessionManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ namespace Microsoft.FeatureManagement
1111
/// </summary>
1212
class EmptySessionManager : ISessionManager
1313
{
14-
public Task SetAsync(string featureName, bool enabled, CancellationToken cancellationToken)
14+
public Task SetAsync(string featureName, bool enabled, CancellationToken _)
1515
{
1616
return Task.CompletedTask;
1717
}
1818

19-
public Task<bool?> GetAsync(string featureName, CancellationToken cancellationToken)
19+
public Task<bool?> GetAsync(string featureName, CancellationToken _)
2020
{
2121
return Task.FromResult((bool?)null);
2222
}

src/Microsoft.FeatureManagement/IContextualFeatureFilter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ public interface IContextualFeatureFilter<TContext> : IFeatureFilterMetadata
2121
/// <param name="appContext">A context defined by the application that is passed in to the feature management system to provide contextual information for evaluating a feature's state.</param>
2222
/// <param name="cancellationToken">The cancellation token to cancel the operation.</param>
2323
/// <returns>True if the filter's criteria has been met, false otherwise.</returns>
24-
Task<bool> EvaluateAsync(FeatureFilterEvaluationContext featureFilterContext, TContext appContext, CancellationToken cancellationToken = default);
24+
Task<bool> EvaluateAsync(FeatureFilterEvaluationContext featureFilterContext, TContext appContext, CancellationToken cancellationToken);
2525
}
2626
}

src/Microsoft.FeatureManagement/IFeatureDefinitionProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ public interface IFeatureDefinitionProvider
1818
/// <param name="featureName">The name of the feature to retrieve the definition for.</param>
1919
/// <param name="cancellationToken">The cancellation token to cancel the operation.</param>
2020
/// <returns>The feature's definition.</returns>
21-
Task<FeatureDefinition> GetFeatureDefinitionAsync(string featureName, CancellationToken cancellationToken = default);
21+
Task<FeatureDefinition> GetFeatureDefinitionAsync(string featureName, CancellationToken cancellationToken);
2222

2323
/// <summary>
2424
/// Retrieves definitions for all features.
2525
/// </summary>
2626
/// <param name="cancellationToken">The cancellation token to cancel the operation.</param>
2727
/// <returns>An enumerator which provides asynchronous iteration over feature definitions.</returns>
28-
IAsyncEnumerable<FeatureDefinition> GetAllFeatureDefinitionsAsync(CancellationToken cancellationToken = default);
28+
IAsyncEnumerable<FeatureDefinition> GetAllFeatureDefinitionsAsync(CancellationToken cancellationToken);
2929
}
3030
}

src/Microsoft.FeatureManagement/IFeatureFilter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ public interface IFeatureFilter : IFeatureFilterMetadata
1717
/// <param name="context">A feature filter evaluation context that contains information that may be needed to evaluate the filter. This context includes configuration, if any, for this filter for the feature being evaluated.</param>
1818
/// <param name="cancellationToken">The cancellation token to cancel the operation.</param>
1919
/// <returns>True if the filter's criteria has been met, false otherwise.</returns>
20-
Task<bool> EvaluateAsync(FeatureFilterEvaluationContext context, CancellationToken cancellationToken = default);
20+
Task<bool> EvaluateAsync(FeatureFilterEvaluationContext context, CancellationToken cancellationToken);
2121
}
2222
}

src/Microsoft.FeatureManagement/IFeatureManager.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ public interface IFeatureManager
1717
/// </summary>
1818
/// <param name="cancellationToken">The cancellation token to cancel the operation.</param>
1919
/// <returns>An enumerator which provides asynchronous iteration over the feature names registered in the feature manager.</returns>
20-
IAsyncEnumerable<string> GetFeatureNamesAsync(CancellationToken cancellationToken = default);
20+
IAsyncEnumerable<string> GetFeatureNamesAsync(CancellationToken cancellationToken);
2121

2222
/// <summary>
2323
/// Checks whether a given feature is enabled.
2424
/// </summary>
2525
/// <param name="feature">The name of the feature to check.</param>
2626
/// <param name="cancellationToken">The cancellation token to cancel the operation.</param>
2727
/// <returns>True if the feature is enabled, otherwise false.</returns>
28-
Task<bool> IsEnabledAsync(string feature, CancellationToken cancellationToken = default);
28+
Task<bool> IsEnabledAsync(string feature, CancellationToken cancellationToken);
2929

3030
/// <summary>
3131
/// Checks whether a given feature is enabled.
@@ -34,6 +34,6 @@ public interface IFeatureManager
3434
/// <param name="context">A context providing information that can be used to evaluate whether a feature should be on or off.</param>
3535
/// <param name="cancellationToken">The cancellation token to cancel the operation.</param>
3636
/// <returns>True if the feature is enabled, otherwise false.</returns>
37-
Task<bool> IsEnabledAsync<TContext>(string feature, TContext context, CancellationToken cancellationToken = default);
37+
Task<bool> IsEnabledAsync<TContext>(string feature, TContext context, CancellationToken cancellationToken);
3838
}
3939
}

0 commit comments

Comments
 (0)