mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
Fixed the reply about denied write commands under maxmemory reached condition: now the error will no longer lead to a client-server protocol desync
This commit is contained in:
parent
500ece7c17
commit
b61a28fe35
13
redis.c
13
redis.c
@ -2187,10 +2187,6 @@ static int processCommand(redisClient *c) {
|
||||
cmd->name));
|
||||
resetClient(c);
|
||||
return 1;
|
||||
} else if (server.maxmemory && cmd->flags & REDIS_CMD_DENYOOM && zmalloc_used_memory() > server.maxmemory) {
|
||||
addReplySds(c,sdsnew("-ERR command not allowed when used memory > 'maxmemory'\r\n"));
|
||||
resetClient(c);
|
||||
return 1;
|
||||
} else if (cmd->flags & REDIS_CMD_BULK && c->bulklen == -1) {
|
||||
/* This is a bulk command, we have to read the last argument yet. */
|
||||
int bulklen = atoi(c->argv[c->argc-1]->ptr);
|
||||
@ -2236,6 +2232,15 @@ static int processCommand(redisClient *c) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Handle the maxmemory directive */
|
||||
if (server.maxmemory && (cmd->flags & REDIS_CMD_DENYOOM) &&
|
||||
zmalloc_used_memory() > server.maxmemory)
|
||||
{
|
||||
addReplySds(c,sdsnew("-ERR command not allowed when used memory > 'maxmemory'\r\n"));
|
||||
resetClient(c);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Exec the command */
|
||||
if (c->flags & REDIS_MULTI && cmd->proc != execCommand && cmd->proc != discardCommand) {
|
||||
queueMultiCommand(c,cmd);
|
||||
|
Loading…
Reference in New Issue
Block a user