Skip to content

Commit

Permalink
chore: Update OpenFeatureHostedService to use ShutdownAsync() method.…
Browse files Browse the repository at this point in the history
… Fix unit tests.

Signed-off-by: André Silva <[email protected]>
  • Loading branch information
askpt committed Jul 1, 2024
1 parent c57fb4f commit a24521e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ async Task IHostedLifecycleService.StartingAsync(CancellationToken cancellationT

Task IHostedService.StopAsync(CancellationToken cancellationToken) => Task.CompletedTask;

Task IHostedLifecycleService.StoppedAsync(CancellationToken cancellationToken) => this._api.Shutdown();
Task IHostedLifecycleService.StoppedAsync(CancellationToken cancellationToken) => this._api.ShutdownAsync();
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
Expand All @@ -12,20 +13,20 @@ sealed class SomeFeatureProvider : FeatureProvider

public override Metadata GetMetadata() => new(Name);

public override Task<ResolutionDetails<bool>> ResolveBooleanValue(string flagKey, bool defaultValue, EvaluationContext? context = null)
=> Task.FromResult(new ResolutionDetails<bool>(flagKey, defaultValue));
public override Task<ResolutionDetails<bool>> ResolveBooleanValueAsync(string flagKey, bool defaultValue, EvaluationContext? context = null,
CancellationToken cancellationToken = default) => Task.FromResult(new ResolutionDetails<bool>(flagKey, defaultValue));

public override Task<ResolutionDetails<string>> ResolveStringValue(string flagKey, string defaultValue, EvaluationContext? context = null)
=> Task.FromResult(new ResolutionDetails<string>(flagKey, defaultValue));
public override Task<ResolutionDetails<string>> ResolveStringValueAsync(string flagKey, string defaultValue, EvaluationContext? context = null,
CancellationToken cancellationToken = default) => Task.FromResult(new ResolutionDetails<string>(flagKey, defaultValue));

public override Task<ResolutionDetails<int>> ResolveIntegerValue(string flagKey, int defaultValue, EvaluationContext? context = null)
=> Task.FromResult(new ResolutionDetails<int>(flagKey, defaultValue));
public override Task<ResolutionDetails<int>> ResolveIntegerValueAsync(string flagKey, int defaultValue, EvaluationContext? context = null,
CancellationToken cancellationToken = default) => Task.FromResult(new ResolutionDetails<int>(flagKey, defaultValue));

public override Task<ResolutionDetails<double>> ResolveDoubleValue(string flagKey, double defaultValue, EvaluationContext? context = null)
=> Task.FromResult(new ResolutionDetails<double>(flagKey, defaultValue));
public override Task<ResolutionDetails<double>> ResolveDoubleValueAsync(string flagKey, double defaultValue, EvaluationContext? context = null,
CancellationToken cancellationToken = default) => Task.FromResult(new ResolutionDetails<double>(flagKey, defaultValue));

public override Task<ResolutionDetails<Value>> ResolveStructureValue(string flagKey, Value defaultValue, EvaluationContext? context = null)
=> Task.FromResult(new ResolutionDetails<Value>(flagKey, defaultValue));
public override Task<ResolutionDetails<Value>> ResolveStructureValueAsync(string flagKey, Value defaultValue, EvaluationContext? context = null,
CancellationToken cancellationToken = default) => Task.FromResult(new ResolutionDetails<Value>(flagKey, defaultValue));
}

public static class SomeFeatureProviderExtensions
Expand Down

0 comments on commit a24521e

Please sign in to comment.