Fix P99 latency issue for TLS where we leave work for the next event loop

tlsProcessPendingData() needs to be called before we execute queued commands because it may enqueue more commands
This commit is contained in:
John Sully committed 2022-08-26 18:05:00 +00:00
1 parent 2a3e0f7cbf
commit dde698ce73
1 file changed
+2 -8
+2 -8
View File
@@ -2795,6 +2795,8 @@ void beforeSleep(struct aeEventLoop *eventLoop) {
AeLocker locker;
int iel = ielFromEventLoop(eventLoop);
tlsProcessPendingData();
locker.arm();
/* end any snapshots created by fast async commands */
@@ -2825,7 +2827,6 @@ void beforeSleep(struct aeEventLoop *eventLoop) {
uint64_t processed = 0;
int aof_state = g_pserver->aof_state;
locker.disarm();
processed += tlsProcessPendingData();
processed += handleClientsWithPendingWrites(iel, aof_state);
locker.arm();
processed += freeClientsInAsyncFreeQueue(iel);
@@ -2836,13 +2837,6 @@ void beforeSleep(struct aeEventLoop *eventLoop) {
/* Handle precise timeouts of blocked clients. */
handleBlockedClientsTimeout();
/* Handle TLS pending data. (must be done before flushAppendOnlyFile) */
if (tlsHasPendingData()) {
locker.disarm();
tlsProcessPendingData();
locker.arm();
}
/* If tls still has pending unread data don't sleep at all. */
aeSetDontWait(eventLoop, tlsHasPendingData());