From 93ad1c2696fd5ccaf1e78fa5a851bcbaf901d09a Mon Sep 17 00:00:00 2001 From: Maurice van Veen Date: Mon, 19 Aug 2024 12:42:25 +0200 Subject: [PATCH] Remove redundant `writer.flushBuffer()` call (#1207) 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 --- src/main/java/io/nats/client/impl/NatsConnection.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/io/nats/client/impl/NatsConnection.java b/src/main/java/io/nats/client/impl/NatsConnection.java index 9f2476840..2eb65eeca 100644 --- a/src/main/java/io/nats/client/impl/NatsConnection.java +++ b/src/main/java/io/nats/client/impl/NatsConnection.java @@ -1323,7 +1323,6 @@ CompletableFuture requestFutureInternal(String subject, Headers headers } publishInternal(subject, responseInbox, headers, data, validateSubRep); - writer.flushBuffer(); statistics.incrementRequestsSent(); return future;