Compare commits

...
Author SHA1 Message Date
John Sully a83ae92190 Sample client enable/disable module API 2020-08-28 18:31:53 +00:00
+12
View File
@@ -4604,6 +4604,18 @@ int moduleUnblockClientByHandle(RedisModuleBlockedClient *bc, void *privdata) {
return REDISMODULE_OK;
}
void RM_DisableClientAsync(RedisModuleCtx *ctx) {
ctx->client->postFunction([](client *c) {
connSetReadHandler(c->conn, nullptr, true);
});
}
void RM_EnableClientAsync(RedisModuleCtx *ctx) {
ctx->client->postFunction([](client *c) {
connSetReadHandler(c->conn, readQueryFromClient, true /* fThreadSafe */);
});
}
/* This API is used by the Redis core to unblock a client that was blocked
* by a module. */
void moduleUnblockClient(client *c) {