Skip to content

Commit 004c48b

Browse files
update to sync GetService method
1 parent 18ae0eb commit 004c48b

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/Microsoft.FeatureManagement/IVariantServiceProvider.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ public interface IVariantServiceProvider<TService> where TService : class
1414
/// <summary>
1515
/// Gets an implementation variant of TService.
1616
/// </summary>
17-
/// <param name="cancellationToken">The cancellation token to cancel the operation.</param>
1817
/// <returns>An implementation of TService.</returns>
19-
ValueTask<TService> GetAsync(CancellationToken cancellationToken);
18+
TService GetService();
2019
}
2120
}

src/Microsoft.FeatureManagement/VariantServiceProvider.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,12 @@ public string VariantFeatureName
4242
/// <summary>
4343
/// Gets implementation of TService according to the assigned variant from the feature flag.
4444
/// </summary>
45-
/// <param name="cancellationToken">The cancellation token to cancel the operation.</param>
4645
/// <returns>An implementation matched with the assigned variant. If there is no matched implementation, it will return null.</returns>
47-
public async ValueTask<TService> GetAsync(CancellationToken cancellationToken)
46+
public TService GetService()
4847
{
4948
Debug.Assert(_variantFeatureName != null);
5049

51-
Variant variant = await _featureManager.GetVariantAsync(_variantFeatureName, cancellationToken);
50+
Variant variant = _featureManager.GetVariantAsync(_variantFeatureName, CancellationToken.None).GetAwaiter().GetResult(); ;
5251

5352
TService implementation = null;
5453

0 commit comments

Comments
 (0)