Do not check buffered response on boot
This commit is contained in:
parent
0a7fe27ca1
commit
ac30bf8aa8
|
@ -10,6 +10,7 @@ import okhttp3.sse.EventSourceListener
|
|||
import org.unifiedpush.distributor.nextpush.api.response.SSEResponse
|
||||
import org.unifiedpush.distributor.nextpush.distributor.Distributor.deleteAppFromSSE
|
||||
import org.unifiedpush.distributor.nextpush.distributor.Distributor.sendMessage
|
||||
import org.unifiedpush.distributor.nextpush.receivers.StartReceiver
|
||||
import org.unifiedpush.distributor.nextpush.services.FailureHandler
|
||||
import org.unifiedpush.distributor.nextpush.services.RestartNetworkCallback
|
||||
import org.unifiedpush.distributor.nextpush.services.RestartWorker
|
||||
|
@ -30,9 +31,13 @@ class SSEListener(val context: Context) : EventSourceListener() {
|
|||
FailureHandler.newEventSource(context, eventSource)
|
||||
startingTimer?.cancel()
|
||||
if (!bufferedResponseChecked) {
|
||||
startingTimer = Timer().schedule(45_000L /* 45secs */) {
|
||||
StartService.stopService()
|
||||
showStartErrorNotification(context)
|
||||
if (StartReceiver.booting) {
|
||||
StartReceiver.booting = false
|
||||
} else {
|
||||
startingTimer = Timer().schedule(45_000L /* 45secs */) {
|
||||
StartService.stopService()
|
||||
showStartErrorNotification(context)
|
||||
}
|
||||
}
|
||||
}
|
||||
StartService.wakeLock?.let {
|
||||
|
|
|
@ -8,8 +8,13 @@ import org.unifiedpush.distributor.nextpush.services.RestartWorker
|
|||
class StartReceiver : BroadcastReceiver() {
|
||||
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
booting = true
|
||||
if (intent.action == Intent.ACTION_BOOT_COMPLETED) {
|
||||
RestartWorker.startPeriodic(context)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
var booting = false
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue