MXS-2329 Use duration with users_refresh_time
This commit is contained in:
@ -871,9 +871,15 @@ that can be changed. The minimum allowed value is 10 seconds. A negative
|
|||||||
value disables the refreshing entirelly. Note that using `maxadmin` it is
|
value disables the refreshing entirelly. Note that using `maxadmin` it is
|
||||||
possible to explicitly cause the users of a service to be reloaded.
|
possible to explicitly cause the users of a service to be reloaded.
|
||||||
```
|
```
|
||||||
users_refresh_time=120
|
users_refresh_time=120s
|
||||||
```
|
```
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
#### `retain_last_statements`
|
#### `retain_last_statements`
|
||||||
|
|
||||||
How many statements MaxScale should store for each session. This is for
|
How many statements MaxScale should store for each session. This is for
|
||||||
|
@ -2609,19 +2609,26 @@ static int handle_global_item(const char* name, const char* value)
|
|||||||
else if (strcmp(name, CN_USERS_REFRESH_TIME) == 0)
|
else if (strcmp(name, CN_USERS_REFRESH_TIME) == 0)
|
||||||
{
|
{
|
||||||
char* endptr;
|
char* endptr;
|
||||||
long users_refresh_time = strtol(value, &endptr, 0);
|
time_t users_refresh_time = strtol(value, &endptr, 0);
|
||||||
if (*endptr == '\0')
|
|
||||||
|
if (*endptr == '\0' && users_refresh_time < 0)
|
||||||
{
|
{
|
||||||
if (users_refresh_time < 0)
|
MXS_NOTICE("Value of '%s' is less than 0, users will "
|
||||||
|
"not be automatically refreshed.",
|
||||||
|
CN_USERS_REFRESH_TIME);
|
||||||
|
// Strictly speaking they will be refreshed once every 68 years,
|
||||||
|
// but I just don't beleave the uptime will be that long.
|
||||||
|
users_refresh_time = INT32_MAX;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Have to "parse" the value anew in case a suffix has been used.
|
||||||
|
if (!get_seconds(name, value, &users_refresh_time))
|
||||||
{
|
{
|
||||||
MXS_NOTICE("Value of '%s' is less than 0, users will "
|
return 0;
|
||||||
"not be automatically refreshed.",
|
|
||||||
CN_USERS_REFRESH_TIME);
|
|
||||||
// Strictly speaking they will be refreshed once every 68 years,
|
|
||||||
// but I just don't beleave the uptime will be that long.
|
|
||||||
users_refresh_time = INT32_MAX;
|
|
||||||
}
|
}
|
||||||
else if (users_refresh_time < USERS_REFRESH_TIME_MIN)
|
|
||||||
|
if (users_refresh_time < USERS_REFRESH_TIME_MIN)
|
||||||
{
|
{
|
||||||
MXS_WARNING("%s is less than the allowed minimum value of %d for the "
|
MXS_WARNING("%s is less than the allowed minimum value of %d for the "
|
||||||
"configuration option '%s', using the minimum value.",
|
"configuration option '%s', using the minimum value.",
|
||||||
@ -2637,14 +2644,9 @@ static int handle_global_item(const char* name, const char* value)
|
|||||||
// we later do arithmetic.
|
// we later do arithmetic.
|
||||||
users_refresh_time = INT32_MAX;
|
users_refresh_time = INT32_MAX;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
gateway.users_refresh_time = users_refresh_time;
|
gateway.users_refresh_time = users_refresh_time;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MXS_ERROR("%s is an invalid value for '%s'.", value, CN_USERS_REFRESH_TIME);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (strcmp(name, CN_WRITEQ_HIGH_WATER) == 0)
|
else if (strcmp(name, CN_WRITEQ_HIGH_WATER) == 0)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user