8000 [FSSDK-9526] refact: Implements a warning log for polling interval less than 30s by mnoman09 · Pull Request #365 · optimizely/csharp-sdk · GitHub
[go: up one dir, main page]

Skip to content

[FSSDK-9526] refact: Implements a warning log for polling interval less than 30s #365

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

Merged
merged 5 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixed comments
  • Loading branch information
NomanShoaib committed Aug 2, 2023
8000
commit 745e361660a2cb315ea235be4553b41a823d88e4
Original file line number Diff line number Diff line change
Expand Up @@ -142,21 +142,20 @@ public void TestTimedoutOnlyIfSchedulerStarted()
[Test]
public void TestWarnLogIfPollingTimeIsLessThanThirty()
{
// period to call is 29 milliseconds
var configManager = new TestPollingProjectConfigManager(TimeSpan.FromMilliseconds(29),
TimeSpan.FromMilliseconds(20), true, LoggerMock.Object, new int[] { });
var below30Seconds = TimeSpan.FromSeconds(29);
_ = new TestPollingProjectConfigManager(below30Seconds,
TimeSpan.FromSeconds(10), true, LoggerMock.Object, new int[] { });
LoggerMock.Verify(l => l.Log(LogLevel.WARN,
"Polling intervals below 30 seconds are not recommended."), Times.Once);
}

[Test]
public void TestWarnLogNotTriggeredIfPollingTimeIsGreaterThanThirty()
{
// period to call is 32 second
var configManager = new TestPollingProjectConfigManager(TimeSpan.FromSeconds(32),
TimeSpan.FromMilliseconds(31), true, LoggerMock.Object, new int[] { });
var above30Seconds = TimeSpan.FromMinutes(1);
_ = new TestPollingProjectConfigManager(above30Seconds,
TimeSpan.FromMilliseconds(10), true, LoggerMock.Object, new int[] { });
LoggerMock.Verify(l => l.Log(LogLevel.WARN,
"Polling intervals below 30 seconds are not recommended."), Times.Once);
"Polling intervals below 30 seconds are not recommended."), Times.Never);
}

[Test]
Expand Down
2 changes: 1 addition & 1 deletion OptimizelySDK/Config/PollingProjectConfigManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public PollingProjectConfigManager(TimeSpan period, TimeSpan blockingTimeout,
Logger = logger;
ErrorHandler = errorHandler;
BlockingTimeout = blockingTimeout;
if (period.TotalMilliseconds < 30)
if (period.Seconds < 30)
{
Logger?.Log(LogLevel.WARN, "Polling intervals below 30 seconds are not recommended.");
}
Expand Down
0