mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 09:00:51 +00:00
Improve style of PR #5084.
This commit is contained in:
parent
526b30a7ce
commit
549b8b9973
10
src/server.c
10
src/server.c
@ -860,13 +860,19 @@ int clientsCronResizeQueryBuffer(client *c) {
|
||||
* cycle. */
|
||||
c->querybuf_peak = 0;
|
||||
|
||||
/* Clients representing masters also use a "pending query buffer" that
|
||||
* is the yet not applied part of the stream we are reading. Such buffer
|
||||
* also needs resizing from time to time, otherwise after a very large
|
||||
* transfer (a huge value or a big MIGRATE operation) it will keep using
|
||||
* a lot of memory. */
|
||||
if (c->flags & CLIENT_MASTER) {
|
||||
/* There are two conditions to resize the pending query buffer:
|
||||
* 1) Pending Query buffer is > LIMIT_PENDING_QUERYBUF.
|
||||
* 2) used length is smaller than pending_querybuf_size/2 */
|
||||
* 2) Used length is smaller than pending_querybuf_size/2 */
|
||||
size_t pending_querybuf_size = sdsAllocSize(c->pending_querybuf);
|
||||
if(pending_querybuf_size > LIMIT_PENDING_QUERYBUF &&
|
||||
sdslen(c->pending_querybuf) < (pending_querybuf_size>>1)){
|
||||
sdslen(c->pending_querybuf) < (pending_querybuf_size/2))
|
||||
{
|
||||
c->pending_querybuf = sdsRemoveFreeSpace(c->pending_querybuf);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user