MXS-2537 Turn 'cluster_monitor_interval' into duration

This commit is contained in:
Johan Wikman
2019-05-31 15:52:55 +03:00
parent 62a9d4f8c1
commit 69dea5a81e
2 changed files with 9 additions and 2 deletions

View File

@ -87,8 +87,12 @@ entire cluster. The default value is 60000 (1 minute), which should not
be lowered as that may have an adverse effect on the Cluster itself.
```
cluster_monitor_interval=120000
cluster_monitor_interval=120000ms
```
The interval is specified as documented
[here](../Getting-Started/Configuration-Guide.md#durations). If no explicit unit
is provided, the value is interpreted as milliseconds in MaxScale 2.4. In subsequent
versions a value without a unit may be rejected.
### `health_check_threshold`

View File

@ -208,6 +208,8 @@ ClustrixMonitor* ClustrixMonitor::create(const string& name, const string& modul
return pThis;
}
using std::chrono::milliseconds;
bool ClustrixMonitor::configure(const MXS_CONFIG_PARAMETER* pParams)
{
if (!MonitorWorker::configure(pParams))
@ -220,7 +222,8 @@ bool ClustrixMonitor::configure(const MXS_CONFIG_PARAMETER* pParams)
m_health_urls.clear();
m_nodes_by_id.clear();
m_config.set_cluster_monitor_interval(pParams->get_integer(CLUSTER_MONITOR_INTERVAL_NAME));
long interval = pParams->get_duration<milliseconds>(CLUSTER_MONITOR_INTERVAL_NAME).count();
m_config.set_cluster_monitor_interval(interval);
m_config.set_health_check_threshold(pParams->get_integer(HEALTH_CHECK_THRESHOLD_NAME));
m_config.set_dynamic_node_detection(pParams->get_bool(DYNAMIC_NODE_DETECTION_NAME));
m_config.set_health_check_port(pParams->get_integer(HEALTH_CHECK_PORT_NAME));