mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
resize query buffer more accurately
1. querybuf_peak has not been updated correctly in readQueryFromClient. 2. qbuf shrinking uses sdsalloc instead of sdsAllocSize see more details in issue #4983
This commit is contained in:
parent
9894ce5fc4
commit
2248eaacac
@ -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);
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user