Skip to content

Commit

Permalink
Optimize building a command.
Browse files Browse the repository at this point in the history
Signed-off-by: Yury-Fridlyand <[email protected]>
  • Loading branch information
Yury-Fridlyand committed Nov 14, 2023
1 parent 447b028 commit a1f8c5a
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -393,14 +393,19 @@ private CompletableFuture<Response> submitNewCommand(RequestType command, List<S
var commandId = getNextCallbackId();
//System.out.printf("== %s(%s), callback %d%n", command, String.join(", ", args), commandId);

var commandArgs = ArgsArray.newBuilder();
for (var arg : args) {
commandArgs.addArgs(arg);
}

return CompletableFuture.supplyAsync(() -> {
RedisRequest request =
RedisRequest.newBuilder()
.setCallbackIdx(commandId.getKey() + callbackOffset)
.setSingleCommand(
Command.newBuilder()
.setRequestType(command)
.setArgsArray(ArgsArray.newBuilder().addAllArgs(args).build())
.setArgsArray(commandArgs.build())
.build())
.setRoute(
Routes.newBuilder()
Expand Down

0 comments on commit a1f8c5a

Please sign in to comment.