From d664990828cf6ef244a424e0d5bcad99ee24ab30 Mon Sep 17 00:00:00 2001 From: songgaoye Date: Tue, 3 Nov 2026 10:17:16 +0800 Subject: [PATCH] Avoid redundant Redis cluster command and reply copies --- src/brpc/redis_cluster.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/brpc/redis_cluster.cpp b/src/brpc/redis_cluster.cpp index ebc0820d5f..bddbf962b8 100644 --- a/src/brpc/redis_cluster.cpp +++ b/src/brpc/redis_cluster.cpp @@ -342,7 +342,7 @@ bool RedisClusterChannel::ParseRequest(const RedisRequest& request, for (size_t i = 0; i < args.size(); ++i) { cmd.args.push_back(args[i].as_string()); } - commands->push_back(cmd); + commands->push_back(std::move(cmd)); } return true; } @@ -476,12 +476,12 @@ bool RedisClusterChannel::ExecuteMGet(const ParsedCommand& cmd, if (!ExecuteSingleCommand(sub_args, nullptr, &sub_result, cntl)) { return false; } - values.push_back(sub_result.encoded_reply); + values.push_back(sub_result.encoded_reply.movable()); } AppendArrayHeader(encoded_reply, values.size()); for (size_t i = 0; i < values.size(); ++i) { - encoded_reply->append(values[i]); + encoded_reply->append(values[i].movable()); } return true; }