From 9b01b64430fbc1487429144d2e4e72a4a7fd9db2 Mon Sep 17 00:00:00 2001 From: antirez Date: Wed, 3 May 2017 14:54:48 +0200 Subject: [PATCH] Modules TSC: put the client in the pending write list. --- src/module.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/module.c b/src/module.c index e14a3943..0ae7ac46 100644 --- a/src/module.c +++ b/src/module.c @@ -3307,7 +3307,19 @@ void moduleHandleBlockedClients(void) { } freeClient(bc->reply_client); - if (c != NULL) unblockClient(c); + if (c != NULL) { + unblockClient(c); + /* Put the client in the list of clients that need to write + * if there are pending replies here. This is needed since + * during a non blocking command the client may receive output. */ + if (clientHasPendingReplies(c) && + !(c->flags & CLIENT_PENDING_WRITE)) + { + c->flags |= CLIENT_PENDING_WRITE; + listAddNodeHead(server.clients_pending_write,c); + } + } + /* Free 'bc' only after unblocking the client, since it is * referenced in the client blocking context, and must be valid * when calling unblockClient(). */