From cafb220768ec777e9e267cf03cfd762aa43300bd Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Thu, 23 Mar 2023 18:53:32 +0100 Subject: [PATCH] Wait 1s before reconnect websocket. --- .../java/fr/pandacube/lib/ws/client/AbstractClientWS.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pandalib-ws-client/src/main/java/fr/pandacube/lib/ws/client/AbstractClientWS.java b/pandalib-ws-client/src/main/java/fr/pandacube/lib/ws/client/AbstractClientWS.java index c898ba0..d103d7d 100644 --- a/pandalib-ws-client/src/main/java/fr/pandacube/lib/ws/client/AbstractClientWS.java +++ b/pandalib-ws-client/src/main/java/fr/pandacube/lib/ws/client/AbstractClientWS.java @@ -106,6 +106,11 @@ public abstract class AbstractClientWS implements AbstractWS { private void reconnectIfNecessary() { synchronized (socket) { if (autoReconnect && !isConnecting && socket.get() == null) { + try { + Thread.sleep(1000); + } catch (InterruptedException ignored) { + Thread.currentThread().interrupt(); + } connect(); } }