From 2fa51552b2e86478036c6b13df591bbc99b10c22 Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Wed, 11 Sep 2024 17:21:41 +0200 Subject: [PATCH] sleep one second before websocket reconnect otherwise it's an endless loop without delay which may stress the devices... Signed-off-by: Marcel Hibbe --- .../main/java/com/nextcloud/talk/webrtc/WebSocketInstance.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/java/com/nextcloud/talk/webrtc/WebSocketInstance.kt b/app/src/main/java/com/nextcloud/talk/webrtc/WebSocketInstance.kt index 73c465a0f..451d4f5ea 100644 --- a/app/src/main/java/com/nextcloud/talk/webrtc/WebSocketInstance.kt +++ b/app/src/main/java/com/nextcloud/talk/webrtc/WebSocketInstance.kt @@ -41,6 +41,7 @@ import org.greenrobot.eventbus.EventBus import org.greenrobot.eventbus.Subscribe import org.greenrobot.eventbus.ThreadMode import java.io.IOException +import java.lang.Thread.sleep import javax.inject.Inject @AutoInjector(NextcloudTalkApplication::class) @@ -127,6 +128,7 @@ class WebSocketInstance internal constructor( isConnected = false messagesQueue = ArrayList() } + sleep(ONE_SECOND) restartWebSocket() } @@ -485,5 +487,6 @@ class WebSocketInstance internal constructor( companion object { private const val TAG = "WebSocketInstance" private const val NORMAL_CLOSURE = 1000 + private const val ONE_SECOND: Long = 1000 } }