mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 09:00:51 +00:00
Modules TSC: HELLO.KEYS reply format fixed.
This commit is contained in:
parent
9b01b64430
commit
7d9326b1f3
@ -115,7 +115,7 @@ int HelloBlock_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int a
|
|||||||
void *HelloKeys_ThreadMain(void *arg) {
|
void *HelloKeys_ThreadMain(void *arg) {
|
||||||
RedisModuleBlockedClient *bc = arg;
|
RedisModuleBlockedClient *bc = arg;
|
||||||
RedisModuleCtx *ctx = RedisModule_GetThreadSafeContext(bc);
|
RedisModuleCtx *ctx = RedisModule_GetThreadSafeContext(bc);
|
||||||
long long cursor = 1;
|
long long cursor = 0;
|
||||||
size_t replylen = 0;
|
size_t replylen = 0;
|
||||||
|
|
||||||
RedisModule_ReplyWithArray(ctx,REDISMODULE_POSTPONED_ARRAY_LEN);
|
RedisModule_ReplyWithArray(ctx,REDISMODULE_POSTPONED_ARRAY_LEN);
|
||||||
@ -125,19 +125,21 @@ void *HelloKeys_ThreadMain(void *arg) {
|
|||||||
"SCAN","l",(long long)cursor);
|
"SCAN","l",(long long)cursor);
|
||||||
RedisModule_ThreadSafeContextUnlock(ctx);
|
RedisModule_ThreadSafeContextUnlock(ctx);
|
||||||
|
|
||||||
size_t items = RedisModule_CallReplyLength(reply);
|
RedisModuleCallReply *cr_cursor =
|
||||||
size_t j;
|
RedisModule_CallReplyArrayElement(reply,0);
|
||||||
for (j = 0; j < items; j++) {
|
RedisModuleCallReply *cr_keys =
|
||||||
|
RedisModule_CallReplyArrayElement(reply,1);
|
||||||
|
|
||||||
|
RedisModuleString *s = RedisModule_CreateStringFromCallReply(cr_cursor);
|
||||||
|
RedisModule_StringToLongLong(s,&cursor);
|
||||||
|
RedisModule_FreeString(ctx,s);
|
||||||
|
|
||||||
|
size_t items = RedisModule_CallReplyLength(cr_keys);
|
||||||
|
for (size_t j = 0; j < items; j++) {
|
||||||
RedisModuleCallReply *ele =
|
RedisModuleCallReply *ele =
|
||||||
RedisModule_CallReplyArrayElement(reply,j);
|
RedisModule_CallReplyArrayElement(cr_keys,j);
|
||||||
if (j == 0) {
|
RedisModule_ReplyWithCallReply(ctx,ele);
|
||||||
RedisModuleString *s = RedisModule_CreateStringFromCallReply(ele);
|
replylen++;
|
||||||
RedisModule_StringToLongLong(s,&cursor);
|
|
||||||
RedisModule_FreeString(ctx,s);
|
|
||||||
} else {
|
|
||||||
RedisModule_ReplyWithCallReply(ctx,ele);
|
|
||||||
replylen++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
RedisModule_FreeCallReply(reply);
|
RedisModule_FreeCallReply(reply);
|
||||||
} while (cursor != 0);
|
} while (cursor != 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user