Skip to content

Commit 2d60197

Browse files
authored
fix: enforce minimum polling interval of 5 minutes (#144)
Enforces a minimum client-side polling interval of 5 minutes. The error message has been slightly updated for clarity.
1 parent 7cd1bb4 commit 2d60197

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

libs/client-sdk/src/data_sources/polling_data_source.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,11 @@ PollingDataSource::PollingDataSource(
9090
data_source_config.method);
9191
if (polling_interval_ < polling_config.min_polling_interval) {
9292
LD_LOG(logger_, LogLevel::kWarn)
93-
<< "Polling interval specified under minimum, defaulting to 30 "
94-
"second polling interval";
93+
<< "Polling interval too frequent, defaulting to "
94+
<< std::chrono::duration_cast<std::chrono::seconds>(
95+
polling_config.min_polling_interval)
96+
.count()
97+
<< " seconds";
9598

9699
polling_interval_ = polling_config.min_polling_interval;
97100
}

libs/common/include/launchdarkly/config/shared/defaults.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,8 @@ struct Defaults<ClientSDK> {
6363
}
6464

6565
static auto PollingConfig() -> shared::built::PollingConfig<ClientSDK> {
66-
// Default to 5 minutes;
67-
return {std::chrono::seconds{5 * 60}, "/msdk/evalx/contexts",
68-
"/msdk/evalx/context", std::chrono::seconds{30}};
66+
return {std::chrono::minutes(5), "/msdk/evalx/contexts",
67+
"/msdk/evalx/context", std::chrono::minutes(5)};
6968
}
7069

7170
static std::size_t MaxCachedContexts() { return 5; }

0 commit comments

Comments
 (0)