mirror of
https://codeberg.org/NextPush/nextpush-android.git
synced 2025-01-29 02:29:19 +01:00
Retry every 10min on failure
This commit is contained in:
parent
830d612095
commit
bbadea2ffe
@ -66,22 +66,25 @@ class SSEListener (val context: Context) : EventSourceListener() {
|
|||||||
Log.d(TAG, "onFailure")
|
Log.d(TAG, "onFailure")
|
||||||
isServiceStarted = false
|
isServiceStarted = false
|
||||||
createWarningNotification(context)
|
createWarningNotification(context)
|
||||||
if (!failed) {
|
val timeStop = if (!failed) {
|
||||||
failed = true
|
2000
|
||||||
Looper.prepare()
|
} else {
|
||||||
object : CountDownTimer(2000, 1000) {
|
60000
|
||||||
|
}.toLong()
|
||||||
|
Log.d(TAG, "Retrying in $timeStop ms")
|
||||||
|
failed = true
|
||||||
|
Looper.prepare()
|
||||||
|
object : CountDownTimer(timeStop, timeStop) {
|
||||||
|
|
||||||
override fun onTick(millisUntilFinished: Long) {
|
override fun onTick(millisUntilFinished: Long) {}
|
||||||
Log.d(TAG, "Restarting in $millisUntilFinished ms")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFinish() {
|
override fun onFinish() {
|
||||||
Log.d(TAG, "Trying to restart")
|
Log.d(TAG, "Trying to restart")
|
||||||
startListener(context)
|
startListener(context)
|
||||||
}
|
}
|
||||||
}.start()
|
|
||||||
Looper.loop()
|
}.start()
|
||||||
}
|
Looper.loop()
|
||||||
t?.let {
|
t?.let {
|
||||||
Log.d(TAG, "An error occurred: $t")
|
Log.d(TAG, "An error occurred: $t")
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user