From acd833a5697d20950c419f9983bac09b4edd8e4e Mon Sep 17 00:00:00 2001 From: Lucas Schmidt Cavalcante Date: Fri, 7 Feb 2025 11:56:24 -0800 Subject: [PATCH] Using the already computed `c->net_input_bytes_curr_cmd` --- src/server.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/server.c b/src/server.c index 77c766df5d..f8bedcaf9a 100644 --- a/src/server.c +++ b/src/server.c @@ -4335,18 +4335,11 @@ int processCommand(client *c) { * disconnection. */ if (server.write_throttling && is_write_command && server.primary_host == NULL) { - /* Size of the command to be stored in the output buffer. */ - unsigned long long command_size = 3 + digits10(c->argc); /* 3: *[argc]\r\n */ - for (int iarg = 0; iarg < c->argc; ++iarg) { - size_t arg_length = sdslen(c->argv[iarg]->ptr); - command_size += 5 + digits10(arg_length) + arg_length; /* 5: $[arglen]\r\n[arg]\r\n */ - } - listIter li; listNode *ln; listRewind(server.replicas, &li); while ((ln = listNext(&li))) { - if (willClientOutputBufferExceedLimits((client *)listNodeValue(ln), command_size)) { + if (willClientOutputBufferExceedLimits((client *)listNodeValue(ln), c->net_input_bytes_curr_cmd)) { rejectCommand(c, shared.throttlederr); return C_OK; }