]> git.saurik.com Git - redis.git/commitdiff
Fixed the reply about denied write commands under maxmemory reached condition: now...
authorantirez <antirez@gmail.com>
Wed, 24 Mar 2010 20:58:34 +0000 (21:58 +0100)
committerantirez <antirez@gmail.com>
Wed, 24 Mar 2010 20:58:34 +0000 (21:58 +0100)
redis.c

diff --git a/redis.c b/redis.c
index 04c2c80b2711eafd55cb68fe50e460068017f8a5..025f9ddac6fd3942a89fd945188359f71b84a2d6 100644 (file)
--- a/redis.c
+++ b/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);