Sample client enable/disable module API
This commit is contained in:
1 parent
f17d178d03
commit
a83ae92190
1 file changed
+12
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user