Skip to content

Commit

Permalink
sleep one second before websocket reconnect
Browse files Browse the repository at this point in the history
otherwise it's an endless loop without delay which may stress the devices...

Signed-off-by: Marcel Hibbe <[email protected]>
  • Loading branch information
mahibi authored and backportbot[bot] committed Sep 12, 2024
1 parent f6c34e6 commit 2fa5155
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -127,6 +128,7 @@ class WebSocketInstance internal constructor(
isConnected = false
messagesQueue = ArrayList()
}
sleep(ONE_SECOND)
restartWebSocket()
}

Expand Down Expand Up @@ -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
}
}

0 comments on commit 2fa5155

Please sign in to comment.