Skip to content

Commit 00a4e4a

Browse files
authored
fix: Remove virtual GetEventChannel from FeatureProvider (#401)
<!-- Please use this template for your pull request. --> <!-- Please use the sections that you need and delete other sections --> ## This PR <!-- add the description of the PR here --> This pull request includes changes to the `EventChannel` handling in the `OpenFeature` library to improve code consistency and reliability. Improvements to `EventChannel` handling: * [`src/OpenFeature/EventExecutor.cs`](diffhunk://#diff-f563baadcf750bb66efaea76d7ec4783320e6efdc45c468effb531c948a2292cL150-R150): Removed unnecessary null-conditional operator when completing the `Writer` of the event channel. * [`src/OpenFeature/FeatureProvider.cs`](diffhunk://#diff-96ebc8fc507d0a19d55b9a5cb57b72a0e8058e09f31ee7d0b39e99b00c5029d8L143-R143): Made the `GetEventChannel` method non-virtual to ensure consistent behavior across different implementations. ### Related Issues <!-- add here the GitHub issue that this PR resolves if applicable --> Related to #358 --------- Signed-off-by: André Silva <[email protected]>
1 parent 46274a2 commit 00a4e4a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/OpenFeature/EventExecutor.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ private void StartListeningAndShutdownOld(FeatureProvider newProvider, FeaturePr
147147
if (oldProvider != null && !this.IsProviderBound(oldProvider))
148148
{
149149
this._activeSubscriptions.Remove(oldProvider);
150-
oldProvider.GetEventChannel()?.Writer.Complete();
150+
oldProvider.GetEventChannel().Writer.Complete();
151151
}
152152
}
153153

src/OpenFeature/FeatureProvider.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public virtual Task ShutdownAsync(CancellationToken cancellationToken = default)
140140
/// Returns the event channel of the provider.
141141
/// </summary>
142142
/// <returns>The event channel of the provider</returns>
143-
public virtual Channel<object> GetEventChannel() => this.EventChannel;
143+
public Channel<object> GetEventChannel() => this.EventChannel;
144144

145145
/// <summary>
146146
/// Track a user action or application state, usually representing a business objective or outcome. The implementation of this method is optional.

0 commit comments

Comments
 (0)