From 06e62f9fa0a0503dd6931342019f52b7f08f9b65 Mon Sep 17 00:00:00 2001 From: lihaipeng <577886328@qq.com> Date: Fri, 8 Aug 2025 19:47:27 +0800 Subject: [PATCH 1/2] support `first` parameter --- src/modules/hellotype.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/modules/hellotype.c b/src/modules/hellotype.c index aecb331a9..010f87cce 100644 --- a/src/modules/hellotype.c +++ b/src/modules/hellotype.c @@ -143,6 +143,9 @@ int HelloTypeRange_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, i struct HelloTypeNode *node = hto ? hto->head : NULL; RedisModule_ReplyWithArray(ctx,REDISMODULE_POSTPONED_LEN); long long arraylen = 0; + while(node && first--) { + node = node->next; + } while(node && count--) { RedisModule_ReplyWithLongLong(ctx,node->value); arraylen++; From af7551e89fbf4b73296f2ff2180f3d6f9a300a3b Mon Sep 17 00:00:00 2001 From: lihaipeng <577886328@qq.com> Date: Tue, 12 Aug 2025 18:32:42 +0800 Subject: [PATCH 2/2] just delete the comment, this bug fixed since redis 7.0, details: https://github.com/redis/redis/pull/9890 --- src/modules/helloworld.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/modules/helloworld.c b/src/modules/helloworld.c index fdeb0a0c1..0ca7f973b 100644 --- a/src/modules/helloworld.c +++ b/src/modules/helloworld.c @@ -214,25 +214,13 @@ int HelloRandArray_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, i } /* This is a simple command to test replication. Because of the "!" modified - * in the RedisModule_Call() call, the two INCRs get replicated. - * Also note how the ECHO is replicated in an unexpected position (check - * comments the function implementation). */ + * in the RedisModule_Call() call, the two INCRs get replicated.*/ int HelloRepl1_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) { REDISMODULE_NOT_USED(argv); REDISMODULE_NOT_USED(argc); RedisModule_AutoMemory(ctx); - /* This will be replicated *after* the two INCR statements, since - * the Call() replication has precedence, so the actual replication - * stream will be: - * - * MULTI - * INCR foo - * INCR bar - * ECHO c foo - * EXEC - */ RedisModule_Replicate(ctx,"ECHO","c","foo"); /* Using the "!" modifier we replicate the command if it