summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhaozhao.zz <zhaozhao.zz@alibaba-inc.com>2020-03-16 11:20:48 +0800
committerzhaozhao.zz <zhaozhao.zz@alibaba-inc.com>2020-03-16 11:20:48 +0800
commitc46c76a3991d769f3d8dff8d221555ac07981801 (patch)
tree2668eaab1ed46f5e92a9783b0bcf05d0cba9961d
parent453e01a091b21c709b4e6163be7d03c8365cca13 (diff)
downloadredis-c46c76a3991d769f3d8dff8d221555ac07981801.tar.gz
Threaded IO: handle pending reads clients ASAP after event loop
-rw-r--r--src/server.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/server.c b/src/server.c
index a6d4b357e..f702da94a 100644
--- a/src/server.c
+++ b/src/server.c
@@ -2088,6 +2088,9 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
void beforeSleep(struct aeEventLoop *eventLoop) {
UNUSED(eventLoop);
+ /* We should handle pending reads clients ASAP after event loop. */
+ handleClientsWithPendingReadsUsingThreads();
+
/* Handle TLS pending data. (must be done before flushAppendOnlyFile) */
tlsProcessPendingData();
/* If tls still has pending unread data don't sleep at all. */
@@ -2157,7 +2160,6 @@ void beforeSleep(struct aeEventLoop *eventLoop) {
void afterSleep(struct aeEventLoop *eventLoop) {
UNUSED(eventLoop);
if (moduleCount()) moduleAcquireGIL();
- handleClientsWithPendingReadsUsingThreads();
}
/* =========================== Server initialization ======================== */