-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: Added set polling interval and set blocking timeout period method in OptimizelyFactory #264
Conversation
…optimizelyFactory
OptimizelySDK/OptimizelyFactory.cs
Outdated
var configManager = builder | ||
.WithSdkKey(httpProjectConfigElement.SDKKey) | ||
.WithUrl(httpProjectConfigElement.Url) | ||
.WithFormat(httpProjectConfigElement.Format) | ||
.WithPollingInterval(TimeSpan.FromMilliseconds(httpProjectConfigElement.PollingInterval)) | ||
.WithBlockingTimeoutPeriod(TimeSpan.FromMilliseconds(httpProjectConfigElement.BlockingTimeOutPeriod)) | ||
.WithPollingInterval(PollingInterval == TimeSpan.Zero ? TimeSpan.FromMilliseconds(httpProjectConfigElement.PollingInterval) : PollingInterval) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PLease update header.
}; | ||
|
||
Assert.AreEqual(actualConfigManagerProps, expectedConfigManagerProps); | ||
|
||
optimizely.Dispose(); | ||
} | ||
|
||
[Test] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add one more priority test. when polling interval is set using method then configelement value is discarded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these tests already show that configElement values will be discarded once we set the polling interval using optimizelyFactory.
Value given in ConfigElement is 2 second, where as we can see that at line 130 and 116 after setting polling Interval using OptlyFactory all other values remained same only polling and blocking interval are changed.
@@ -78,8 +77,8 @@ public void TestProjectConfigManagerUsingSDKKey() | |||
Url = "https://cdn.optimizely.com/datafiles/my-sdk-key.json", | |||
LastModified = "", | |||
AutoUpdate = true, | |||
BlockingTimeout = TimeSpan.FromSeconds(15), | |||
PollingInterval = TimeSpan.FromMinutes(5) | |||
BlockingTimeout = TimeSpan.FromSeconds(30), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update header.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good. One concern is we have 3 similar factory methods, which can have totally different config data paths (see comments) for timeout values. Can we merge and make them consistent?
.WithPollingInterval(PollingInterval) | ||
.WithBlockingTimeoutPeriod(BlockingTimeOutPeriod) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused - why don't have the config reading unlike the above:
.WithPollingInterval(PollingInterval == TimeSpan.Zero ? TimeSpan.FromMilliseconds(httpProjectConfigElement.PollingInterval) : PollingInterval)
This can have different configuration paths depending on factory method parameters. It can be confusing unless we document very clearly about them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Summary
Test plan
All Unit tests and FSC tests should pass.
Issues