Skip to content

Commit b08463a

Browse files
committed
address feadback
1 parent 88078c3 commit b08463a

File tree

2 files changed

+9
-28
lines changed

2 files changed

+9
-28
lines changed

pkgs/sdk/client/src/Hooks/EvaluationSeriesContext.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,18 @@ public sealed class EvaluationSeriesContext {
2525
/// </summary>
2626
public string Method { get; }
2727

28-
/// <summary>
29-
/// The environment ID for the evaluation, or null if not available.
30-
/// </summary>
31-
public string EnvironmentId { get; }
32-
3328
/// <summary>
3429
/// Constructs a new EvaluationSeriesContext.
3530
/// </summary>
3631
/// <param name="flagKey">the flag key</param>
3732
/// <param name="context">the context</param>
3833
/// <param name="defaultValue">the default value</param>
3934
/// <param name="method">the variation method</param>
40-
/// <param name="environmentId">the environment ID</param>
41-
public EvaluationSeriesContext(string flagKey, Context context, LdValue defaultValue, string method,
42-
string environmentId = null) {
35+
public EvaluationSeriesContext(string flagKey, Context context, LdValue defaultValue, string method) {
4336
FlagKey = flagKey;
4437
Context = context;
4538
DefaultValue = defaultValue;
4639
Method = method;
47-
EnvironmentId = environmentId;
4840
}
4941
}
5042
}

pkgs/sdk/client/src/LdClient.cs

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ public sealed class LdClient : ILdClient
7373
readonly AnonymousKeyContextDecorator _anonymousKeyContextDecorator;
7474
private readonly AutoEnvContextDecorator _autoEnvContextDecorator;
7575
private readonly IHookExecutor _hookExecutor;
76-
private List<Hook> _pluginHooks = new List<Hook>();
7776

7877
private readonly Logger _log;
7978

@@ -234,27 +233,17 @@ public sealed class LdClient : ILdClient
234233
});
235234
}
236235

237-
PluginConfiguration pluginConfig = null;
238-
EnvironmentMetadata environmentMetadata = null;
239-
if (_config.Plugins != null)
240-
{
241-
pluginConfig = _config.Plugins.Build();
242-
if (pluginConfig.Plugins.Any())
243-
{
244-
environmentMetadata = CreateEnvironmentMetadata();
245-
_pluginHooks = this.GetPluginHooks(pluginConfig.Plugins, environmentMetadata, _log);
246-
}
247-
}
236+
var pluginConfig = (_config.Plugins ?? Components.Plugins()).Build();
237+
var environmentMetadata = pluginConfig.Plugins.Any() ? CreateEnvironmentMetadata() : null;
238+
var hooks = pluginConfig.Plugins.Any()
239+
? this.GetPluginHooks(pluginConfig.Plugins, environmentMetadata, _log)
240+
: new List<Hook>();
248241

249-
_hookExecutor = _pluginHooks.Any()
250-
? (IHookExecutor)new Executor(_log.SubLogger(LogNames.HooksSubLog), _pluginHooks)
242+
_hookExecutor = hooks.Any()
243+
? (IHookExecutor)new Executor(_log.SubLogger(LogNames.HooksSubLog), hooks)
251244
: new NoopExecutor();
252245

253-
// Register plugins after creating the hook executor to ensure hooks are available
254-
if (pluginConfig != null && pluginConfig.Plugins.Any())
255-
{
256-
this.RegisterPlugins(pluginConfig.Plugins, environmentMetadata, _log);
257-
}
246+
this.RegisterPlugins(pluginConfig.Plugins, environmentMetadata, _log);
258247

259248
_backgroundModeManager = _config.BackgroundModeManager ?? new DefaultBackgroundModeManager();
260249
_backgroundModeManager.BackgroundModeChanged += OnBackgroundModeChanged;

0 commit comments

Comments
 (0)