From f090bed41ef2883869676d9968e6978db6733a4c Mon Sep 17 00:00:00 2001 From: Scott Fauerbach Date: Mon, 20 May 2024 09:57:07 -0400 Subject: [PATCH] Remove duplicate reconnect event (#1151) --- src/main/java/io/nats/client/impl/NatsConnection.java | 2 -- src/test/java/io/nats/client/impl/ConnectionListenerTests.java | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/io/nats/client/impl/NatsConnection.java b/src/main/java/io/nats/client/impl/NatsConnection.java index 966edcf60..18d0f677e 100644 --- a/src/main/java/io/nats/client/impl/NatsConnection.java +++ b/src/main/java/io/nats/client/impl/NatsConnection.java @@ -438,8 +438,6 @@ else if (first.equals(cur)) { processConnectionEvent(Events.RESUBSCRIBED); - processConnectionEvent(Events.RECONNECTED); - // When the flush returns we are done sending internal messages, // so we can switch to the non-reconnect queue this.writer.setReconnectMode(false); diff --git a/src/test/java/io/nats/client/impl/ConnectionListenerTests.java b/src/test/java/io/nats/client/impl/ConnectionListenerTests.java index 00d9651a1..ce9cdd7a4 100644 --- a/src/test/java/io/nats/client/impl/ConnectionListenerTests.java +++ b/src/test/java/io/nats/client/impl/ConnectionListenerTests.java @@ -96,7 +96,7 @@ public void testDisconnectReconnectCount() throws Exception { try (NatsTestServer ts = new NatsTestServer(port, false)) { standardConnectionWait(nc); - assertEquals(2, listener.getEventCount(Events.RECONNECTED)); + assertEquals(1, listener.getEventCount(Events.RECONNECTED)); assertEquals(ts.getURI(), nc.getConnectedUrl()); standardCloseConnection(nc); }