mirror of
https://github.com/fluencelabs/redis
synced 2025-04-25 02:22:13 +00:00
Precise timeouts: fix bugs in initial implementation.
This commit is contained in:
parent
324a8c91d0
commit
8d11e0df7a
@ -111,6 +111,7 @@ void blockClient(client *c, int btype) {
|
|||||||
c->btype = btype;
|
c->btype = btype;
|
||||||
server.blocked_clients++;
|
server.blocked_clients++;
|
||||||
server.blocked_clients_by_type[btype]++;
|
server.blocked_clients_by_type[btype]++;
|
||||||
|
addClientToShortTimeoutTable(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function is called in the beforeSleep() function of the event loop
|
/* This function is called in the beforeSleep() function of the event loop
|
||||||
@ -619,7 +620,6 @@ void blockForKeys(client *c, int btype, robj **keys, int numkeys, mstime_t timeo
|
|||||||
listAddNodeTail(l,c);
|
listAddNodeTail(l,c);
|
||||||
}
|
}
|
||||||
blockClient(c,btype);
|
blockClient(c,btype);
|
||||||
addClientToShortTimeoutTable(c);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unblock a client that's waiting in a blocking operation such as BLPOP.
|
/* Unblock a client that's waiting in a blocking operation such as BLPOP.
|
||||||
|
@ -1588,6 +1588,7 @@ void clientsHandleShortTimeout(void) {
|
|||||||
uint64_t now = mstime();
|
uint64_t now = mstime();
|
||||||
raxIterator ri;
|
raxIterator ri;
|
||||||
raxStart(&ri,server.clients_timeout_table);
|
raxStart(&ri,server.clients_timeout_table);
|
||||||
|
raxSeek(&ri,"^",NULL,0);
|
||||||
|
|
||||||
while(raxNext(&ri)) {
|
while(raxNext(&ri)) {
|
||||||
uint64_t id, timeout;
|
uint64_t id, timeout;
|
||||||
@ -1745,6 +1746,9 @@ void getExpansiveClientsInfo(size_t *in_usage, size_t *out_usage) {
|
|||||||
*/
|
*/
|
||||||
#define CLIENTS_CRON_MIN_ITERATIONS 5
|
#define CLIENTS_CRON_MIN_ITERATIONS 5
|
||||||
void clientsCron(void) {
|
void clientsCron(void) {
|
||||||
|
/* Unblock short timeout clients ASAP. */
|
||||||
|
clientsHandleShortTimeout();
|
||||||
|
|
||||||
/* Try to process at least numclients/server.hz of clients
|
/* Try to process at least numclients/server.hz of clients
|
||||||
* per call. Since normally (if there are no big latency events) this
|
* per call. Since normally (if there are no big latency events) this
|
||||||
* function is called server.hz times per second, in the average case we
|
* function is called server.hz times per second, in the average case we
|
||||||
|
Loading…
x
Reference in New Issue
Block a user