Skip to content

Commit

Permalink
Remove redundant writer.flushBuffer() call (#1207)
Browse files Browse the repository at this point in the history
When doing a request through `requestFutureInternal` we'd publish the message into the outgoing write queue, and immediately after call `writer.flushBuffer()`.

Due to the message needing to go through the outgoing message queue, which takes a small amount of time, the `flushBuffer` would be done first and before our message got written to the `dataPort`.

Removing the call to `writer.flushBuffer()` since it doesn't actually flush our message/request.

Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
  • Loading branch information
MauriceVanVeen authored Aug 19, 2024
1 parent d4849d8 commit 93ad1c2
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/main/java/io/nats/client/impl/NatsConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,6 @@ CompletableFuture<Message> requestFutureInternal(String subject, Headers headers
}

publishInternal(subject, responseInbox, headers, data, validateSubRep);
writer.flushBuffer();
statistics.incrementRequestsSent();

return future;
Expand Down

0 comments on commit 93ad1c2

Please sign in to comment.