You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the link https://redis.io/docs/reference/modules/modules-blocking-ops/
I found the latest example code is not correct, as RedisModule_IsBlockedReplyRequest should be used the general_func other than in the Example_RedisCommand function.
BRs,
int general_func(RedisModuleCtx *ctx, RedisModuleString **argv,
int argc)
{
if (RedisModule_IsBlockedReplyRequest(ctx)) {
long *mynumber = RedisModule_GetBlockedClientPrivateData(ctx);
return RedisModule_ReplyWithLongLong(ctx,mynumber);
} else if (RedisModule_IsBlockedTimeoutRequest(ctx)) {
return RedisModule_ReplyWithNull(ctx);
}
}
int Example_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv,
int argc)
{
RedisModuleBlockedClient *bc =
RedisModule_BlockClient(ctx,general_func,general_func,NULL,0);
pthread_t tid;
if (pthread_create(&tid,NULL,threadmain,bc) != 0) {
RedisModule_AbortBlock(bc);
RedisModule_ReplyWithError(ctx,"Sorry can't create a thread");
}
return REDISMODULE_OK;
}
The text was updated successfully, but these errors were encountered:
In the link https://redis.io/docs/reference/modules/modules-blocking-ops/
I found the latest example code is not correct, as RedisModule_IsBlockedReplyRequest should be used the general_func other than in the Example_RedisCommand function.
BRs,
int general_func(RedisModuleCtx *ctx, RedisModuleString **argv,
int argc)
{
if (RedisModule_IsBlockedReplyRequest(ctx)) {
long *mynumber = RedisModule_GetBlockedClientPrivateData(ctx);
return RedisModule_ReplyWithLongLong(ctx,mynumber);
} else if (RedisModule_IsBlockedTimeoutRequest(ctx)) {
return RedisModule_ReplyWithNull(ctx);
}
}
int Example_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv,
int argc)
{
}
The text was updated successfully, but these errors were encountered: