Merge pull request #6385 from filipecosta90/perf-reply-ss-error
Improve performance of RM_ReplyWithSimpleString and RM_ReplyWi…
This commit is contained in:
commit
ad45d7e407
@ -1149,10 +1149,11 @@ int RM_ReplyWithLongLong(RedisModuleCtx *ctx, long long ll) {
|
|||||||
int replyWithStatus(RedisModuleCtx *ctx, const char *msg, char *prefix) {
|
int replyWithStatus(RedisModuleCtx *ctx, const char *msg, char *prefix) {
|
||||||
client *c = moduleGetReplyClient(ctx);
|
client *c = moduleGetReplyClient(ctx);
|
||||||
if (c == NULL) return REDISMODULE_OK;
|
if (c == NULL) return REDISMODULE_OK;
|
||||||
sds strmsg = sdsnewlen(prefix,1);
|
const size_t msgLen = strlen(msg);
|
||||||
strmsg = sdscat(strmsg,msg);
|
const size_t prefixLen = strlen(prefix);
|
||||||
strmsg = sdscatlen(strmsg,"\r\n",2);
|
addReplyProto(c,prefix,prefixLen);
|
||||||
addReplySds(c,strmsg);
|
addReplyProto(c,msg,msgLen);
|
||||||
|
addReplyProto(c,"\r\n",2);
|
||||||
return REDISMODULE_OK;
|
return REDISMODULE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user