mirror of
https://github.com/fluencelabs/redis
synced 2025-03-18 16:40:50 +00:00
Fix processEventsWhileBlocked() to handle PENDING_WRITE clients.
After the introduction of the list with clients with pending writes, to process clients incrementally outside of the event loop we also need to process the pending writes list.
This commit is contained in:
parent
1e7153831d
commit
01c08b5089
@ -938,9 +938,10 @@ void sendReplyToClient(aeEventLoop *el, int fd, void *privdata, int mask) {
|
||||
* we can just write the replies to the client output buffer without any
|
||||
* need to use a syscall in order to install the writable event handler,
|
||||
* get it called, and so forth. */
|
||||
void handleClientsWithPendingWrites(void) {
|
||||
int handleClientsWithPendingWrites(void) {
|
||||
listIter li;
|
||||
listNode *ln;
|
||||
int processed = listLength(server.clients_pending_write);
|
||||
|
||||
listRewind(server.clients_pending_write,&li);
|
||||
while((ln = listNext(&li))) {
|
||||
@ -960,6 +961,7 @@ void handleClientsWithPendingWrites(void) {
|
||||
freeClientAsync(c);
|
||||
}
|
||||
}
|
||||
return processed;
|
||||
}
|
||||
|
||||
/* resetClient prepare the client to process the next command */
|
||||
@ -1821,7 +1823,9 @@ int processEventsWhileBlocked(void) {
|
||||
int iterations = 4; /* See the function top-comment. */
|
||||
int count = 0;
|
||||
while (iterations--) {
|
||||
int events = aeProcessEvents(server.el, AE_FILE_EVENTS|AE_DONT_WAIT);
|
||||
int events = 0;
|
||||
events += aeProcessEvents(server.el, AE_FILE_EVENTS|AE_DONT_WAIT);
|
||||
events += handleClientsWithPendingWrites();
|
||||
if (!events) break;
|
||||
count += events;
|
||||
}
|
||||
|
@ -1110,7 +1110,7 @@ int listenToPort(int port, int *fds, int *count);
|
||||
void pauseClients(mstime_t duration);
|
||||
int clientsArePaused(void);
|
||||
int processEventsWhileBlocked(void);
|
||||
void handleClientsWithPendingWrites(void);
|
||||
int handleClientsWithPendingWrites(void);
|
||||
int clientHasPendingReplies(client *c);
|
||||
void unlinkClient(client *c);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user