diff --git a/src/networking.c b/src/networking.c index 6ab16e293..805f3f0e9 100644 --- a/src/networking.c +++ b/src/networking.c @@ -2147,7 +2147,6 @@ void readQueryFromClient(connection *conn) { } qblen = sdslen(c->querybuf); - if (c->querybuf_peak < qblen) c->querybuf_peak = qblen; if (big_arg || sdsalloc(c->querybuf) < PROTO_IOBUF_LEN) { /* When reading a BIG_ARG we won't be reading more than that one arg * into the query buffer, so we don't need to pre-allocate more than we @@ -2187,6 +2186,9 @@ void readQueryFromClient(connection *conn) { } sdsIncrLen(c->querybuf,nread); + qblen = sdslen(c->querybuf); + if (c->querybuf_peak < qblen) c->querybuf_peak = qblen; + c->lastinteraction = server.unixtime; if (c->flags & CLIENT_MASTER) c->read_reploff += nread; atomicIncr(server.stat_net_input_bytes, nread); diff --git a/src/server.c b/src/server.c index dbc0a04e2..27a2f6c46 100644 --- a/src/server.c +++ b/src/server.c @@ -1664,7 +1664,7 @@ long long getInstantaneousMetric(int metric) { * * The function always returns 0 as it never terminates the client. */ int clientsCronResizeQueryBuffer(client *c) { - size_t querybuf_size = sdsAllocSize(c->querybuf); + size_t querybuf_size = sdsalloc(c->querybuf); time_t idletime = server.unixtime - c->lastinteraction; /* There are two conditions to resize the query buffer: