mirror of
https://github.com/fluencelabs/redis
synced 2025-04-13 12:46:03 +00:00
CONFIG SET: additional 2 numerical fields refactored.
This commit is contained in:
parent
d68f28a367
commit
3da7408359
19
src/config.c
19
src/config.c
@ -770,9 +770,6 @@ void configSetCommand(redisClient *c) {
|
|||||||
addReplyErrorFormat(c,"Changing directory: %s", strerror(errno));
|
addReplyErrorFormat(c,"Changing directory: %s", strerror(errno));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (!strcasecmp(c->argv[2]->ptr,"slowlog-max-len")) {
|
|
||||||
if (getLongLongFromObject(o,&ll) == REDIS_ERR || ll < 0) goto badfmt;
|
|
||||||
server.slowlog_max_len = (unsigned)ll;
|
|
||||||
} else if (!strcasecmp(c->argv[2]->ptr,"loglevel")) {
|
} else if (!strcasecmp(c->argv[2]->ptr,"loglevel")) {
|
||||||
if (!strcasecmp(o->ptr,"warning")) {
|
if (!strcasecmp(o->ptr,"warning")) {
|
||||||
server.verbosity = REDIS_WARNING;
|
server.verbosity = REDIS_WARNING;
|
||||||
@ -834,12 +831,6 @@ void configSetCommand(redisClient *c) {
|
|||||||
ll = memtoll(o->ptr,&err);
|
ll = memtoll(o->ptr,&err);
|
||||||
if (err || ll < 0) goto badfmt;
|
if (err || ll < 0) goto badfmt;
|
||||||
resizeReplicationBacklog(ll);
|
resizeReplicationBacklog(ll);
|
||||||
} else if (!strcasecmp(c->argv[2]->ptr,"watchdog-period")) {
|
|
||||||
if (getLongLongFromObject(o,&ll) == REDIS_ERR || ll < 0) goto badfmt;
|
|
||||||
if (ll)
|
|
||||||
enableWatchdog(ll);
|
|
||||||
else
|
|
||||||
disableWatchdog();
|
|
||||||
} else if (!strcasecmp(c->argv[2]->ptr,"notify-keyspace-events")) {
|
} else if (!strcasecmp(c->argv[2]->ptr,"notify-keyspace-events")) {
|
||||||
int flags = keyspaceEventsStringToFlags(o->ptr);
|
int flags = keyspaceEventsStringToFlags(o->ptr);
|
||||||
|
|
||||||
@ -901,6 +892,10 @@ void configSetCommand(redisClient *c) {
|
|||||||
"lua-time-limit",server.lua_time_limit,0,LLONG_MAX) {
|
"lua-time-limit",server.lua_time_limit,0,LLONG_MAX) {
|
||||||
} config_set_numerical_field(
|
} config_set_numerical_field(
|
||||||
"slowlog-log-slower-than",server.slowlog_log_slower_than,0,LLONG_MAX) {
|
"slowlog-log-slower-than",server.slowlog_log_slower_than,0,LLONG_MAX) {
|
||||||
|
} config_set_numerical_field(
|
||||||
|
"slowlog-max-len",ll,0,LLONG_MAX) {
|
||||||
|
/* Cast to unsigned. */
|
||||||
|
server.slowlog_max_len = (unsigned)ll;
|
||||||
} config_set_numerical_field(
|
} config_set_numerical_field(
|
||||||
"latency-monitor-threshold",server.latency_monitor_threshold,0,LLONG_MAX){
|
"latency-monitor-threshold",server.latency_monitor_threshold,0,LLONG_MAX){
|
||||||
} config_set_numerical_field(
|
} config_set_numerical_field(
|
||||||
@ -931,6 +926,12 @@ void configSetCommand(redisClient *c) {
|
|||||||
* but cap them to reasonable values. */
|
* but cap them to reasonable values. */
|
||||||
if (server.hz < REDIS_MIN_HZ) server.hz = REDIS_MIN_HZ;
|
if (server.hz < REDIS_MIN_HZ) server.hz = REDIS_MIN_HZ;
|
||||||
if (server.hz > REDIS_MAX_HZ) server.hz = REDIS_MAX_HZ;
|
if (server.hz > REDIS_MAX_HZ) server.hz = REDIS_MAX_HZ;
|
||||||
|
} config_set_numerical_field(
|
||||||
|
"watchdog-period",ll,0,LLONG_MAX) {
|
||||||
|
if (ll)
|
||||||
|
enableWatchdog(ll);
|
||||||
|
else
|
||||||
|
disableWatchdog();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Everyhing else is an error... */
|
/* Everyhing else is an error... */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user