From 35b90bf61a239d01f90210ccf1842ed68315e153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <2493377+askpt@users.noreply.github.com> Date: Wed, 4 Dec 2024 17:02:30 +0000 Subject: [PATCH] Fix cleanup. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com> --- src/OpenFeature/Api.cs | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/OpenFeature/Api.cs b/src/OpenFeature/Api.cs index 7c6f51b1..f778c659 100644 --- a/src/OpenFeature/Api.cs +++ b/src/OpenFeature/Api.cs @@ -48,9 +48,8 @@ private Api() { } public async Task SetProviderAsync(FeatureProvider featureProvider) { this._eventExecutor.RegisterDefaultFeatureProvider(featureProvider); - await this._repository - .SetProviderAsync(featureProvider, this.GetContext(), this.AfterInitialization, this.AfterError) - .ConfigureAwait(false); + await this._repository.SetProviderAsync(featureProvider, this.GetContext(), this.AfterInitialization, this.AfterError).ConfigureAwait(false); + } /// @@ -65,11 +64,8 @@ public async Task SetProviderAsync(string domain, FeatureProvider featureProvide { throw new ArgumentNullException(nameof(domain)); } - this._eventExecutor.RegisterClientFeatureProvider(domain, featureProvider); - await this._repository - .SetProviderAsync(domain, featureProvider, this.GetContext(), this.AfterInitialization, this.AfterError) - .ConfigureAwait(false); + await this._repository.SetProviderAsync(domain, featureProvider, this.GetContext(), this.AfterInitialization, this.AfterError).ConfigureAwait(false); } /// @@ -345,8 +341,7 @@ private async Task AfterInitialization(FeatureProvider provider) ProviderName = provider.GetMetadata()?.Name, }; - await this._eventExecutor.EventChannel.Writer - .WriteAsync(new Event { Provider = provider, EventPayload = eventPayload }).ConfigureAwait(false); + await this._eventExecutor.EventChannel.Writer.WriteAsync(new Event { Provider = provider, EventPayload = eventPayload }).ConfigureAwait(false); } /// @@ -354,9 +349,7 @@ await this._eventExecutor.EventChannel.Writer /// private async Task AfterError(FeatureProvider provider, Exception? ex) { - provider.Status = typeof(ProviderFatalException) == ex?.GetType() - ? ProviderStatus.Fatal - : ProviderStatus.Error; + provider.Status = typeof(ProviderFatalException) == ex?.GetType() ? ProviderStatus.Fatal : ProviderStatus.Error; var eventPayload = new ProviderEventPayload { Type = ProviderEventTypes.ProviderError, @@ -364,8 +357,7 @@ private async Task AfterError(FeatureProvider provider, Exception? ex) ProviderName = provider.GetMetadata()?.Name, }; - await this._eventExecutor.EventChannel.Writer - .WriteAsync(new Event { Provider = provider, EventPayload = eventPayload }).ConfigureAwait(false); + await this._eventExecutor.EventChannel.Writer.WriteAsync(new Event { Provider = provider, EventPayload = eventPayload }).ConfigureAwait(false); } } }