Merge pull request #6993 from soloestoy/optimize-threaded-io

Threaded IO: handle pending reads clients ASAP after event loop
This commit is contained in:
Salvatore Sanfilippo 2020-03-16 10:48:23 +01:00 committed by GitHub
commit f1e4af2c29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2088,6 +2088,9 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
void beforeSleep(struct aeEventLoop *eventLoop) { void beforeSleep(struct aeEventLoop *eventLoop) {
UNUSED(eventLoop); UNUSED(eventLoop);
/* We should handle pending reads clients ASAP after event loop. */
handleClientsWithPendingReadsUsingThreads();
/* Handle TLS pending data. (must be done before flushAppendOnlyFile) */ /* Handle TLS pending data. (must be done before flushAppendOnlyFile) */
tlsProcessPendingData(); tlsProcessPendingData();
/* If tls still has pending unread data don't sleep at all. */ /* 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) { void afterSleep(struct aeEventLoop *eventLoop) {
UNUSED(eventLoop); UNUSED(eventLoop);
if (moduleCount()) moduleAcquireGIL(); if (moduleCount()) moduleAcquireGIL();
handleClientsWithPendingReadsUsingThreads();
} }
/* =========================== Server initialization ======================== */ /* =========================== Server initialization ======================== */