MXS-2329 Use durations with connection_timeout

This commit is contained in:
Johan Wikman 2019-04-29 10:49:26 +03:00
parent 638debcdc0
commit 9fb4116bf5
3 changed files with 11 additions and 4 deletions

View File

@ -1401,6 +1401,12 @@ default. To enable them, define the timeout in seconds in the service's
configuration section. A value of zero is interpreted as no timeout, the same
as if the parameter is not defined.
The value is specified as documented [here](#durations). If no explicit unit
is provided, the value is interpreted as seconds in MaxScale 2.4. In subsequent
versions a value without a unit may be rejected. Note that since the granularity
of the timeout is seconds, a timeout specified in milliseconds will be rejected,
even if the duration is longer than a second.
**Warning:** If a connection is idle for longer than the configured connection
timeout, it will be forcefully disconnected and a warning will be logged in the
MaxScale log file. If you are performing long-running maintenance operations
@ -1411,7 +1417,7 @@ Example:
```
[Test-Service]
connection_timeout=300
connection_timeout=300s
```
#### `max_connections`

View File

@ -336,8 +336,9 @@ const MXS_MODULE_PARAM config_service_params[] =
},
{
CN_CONNECTION_TIMEOUT,
MXS_MODULE_PARAM_COUNT,
"0"
MXS_MODULE_PARAM_DURATION,
"0",
MXS_MODULE_OPT_DURATION_S
},
{
CN_AUTH_ALL_SERVERS,

View File

@ -219,7 +219,7 @@ Service::Service(const std::string& name,
localhost_match_wildcard_host = params->get_bool(CN_LOCALHOST_MATCH_WILDCARD_HOST);
retry_start = params->get_bool(CN_RETRY_ON_FAILURE);
enable_root = params->get_bool(CN_ENABLE_ROOT_USER);
conn_idle_timeout = params->get_integer(CN_CONNECTION_TIMEOUT);
conn_idle_timeout = params->get_duration<std::chrono::seconds>(CN_CONNECTION_TIMEOUT).count();
max_connections = params->get_integer(CN_MAX_CONNECTIONS);
log_auth_warnings = params->get_bool(CN_LOG_AUTH_WARNINGS);
strip_db_esc = params->get_bool(CN_STRIP_DB_ESC);