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++; 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