Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
8d11e0df
Commit
8d11e0df
authored
Mar 26, 2020
by
antirez
Browse files
Precise timeouts: fix bugs in initial implementation.
parent
324a8c91
Changes
2
Show whitespace changes
Inline
Side-by-side
src/blocked.c
View file @
8d11e0df
...
...
@@ -111,6 +111,7 @@ void blockClient(client *c, int btype) {
c
->
btype
=
btype
;
server
.
blocked_clients
++
;
server
.
blocked_clients_by_type
[
btype
]
++
;
addClientToShortTimeoutTable
(
c
);
}
/* 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
);
}
blockClient
(
c
,
btype
);
addClientToShortTimeoutTable
(
c
);
}
/* Unblock a client that's waiting in a blocking operation such as BLPOP.
...
...
src/server.c
View file @
8d11e0df
...
...
@@ -1588,6 +1588,7 @@ void clientsHandleShortTimeout(void) {
uint64_t now = mstime();
raxIterator ri;
raxStart(&ri,server.clients_timeout_table);
raxSeek(&ri,"^",NULL,0);
while(raxNext(&ri)) {
uint64_t id, timeout;
...
...
@@ -1745,6 +1746,9 @@ void getExpansiveClientsInfo(size_t *in_usage, size_t *out_usage) {
*/
#define CLIENTS_CRON_MIN_ITERATIONS 5
void clientsCron(void) {
/* Unblock short timeout clients ASAP. */
clientsHandleShortTimeout();
/* Try to process at least numclients/server.hz of clients
* 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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment