diff options
-rw-r--r-- | juick-api/src/main/java/com/juick/api/ApiServer.java | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/juick-api/src/main/java/com/juick/api/ApiServer.java b/juick-api/src/main/java/com/juick/api/ApiServer.java index 83e21e22..f4dd4d99 100644 --- a/juick-api/src/main/java/com/juick/api/ApiServer.java +++ b/juick-api/src/main/java/com/juick/api/ApiServer.java @@ -114,16 +114,11 @@ public class ApiServer implements ApplicationListener<DisconnectedEvent>, AutoCl logger.warn("attachment error", e1); } } - @Scheduled(fixedRate = 60000) - public void reconnectWebsocket() { - if (!webSocketConnectionManager.isRunning()) { - logger.info("retrying..."); - webSocketConnectionManager.stop(); - webSocketConnectionManager.start(); - } - } + @Override public void onApplicationEvent(@Nonnull DisconnectedEvent event) { - reconnectWebsocket(); + logger.info("retrying..."); + webSocketConnectionManager.stop(); + webSocketConnectionManager.start(); } } |