Count fails since service start

This commit is contained in:
sim 2023-05-30 22:56:52 +02:00
parent adcf14e499
commit 0a7fe27ca1
1 changed files with 11 additions and 2 deletions

View File

@ -11,8 +11,15 @@ import org.unifiedpush.distributor.nextpush.utils.TAG
object FailureHandler { object FailureHandler {
private var ttlFails = 0
var nFails = 0 var nFails = 0
private set private set(value) {
if (value > 0) {
ttlFails += 1
}
field = value
}
private var nFailsBeforePing = 0 private var nFailsBeforePing = 0
@ -79,6 +86,7 @@ object FailureHandler {
} }
fun clearFails() { fun clearFails() {
ttlFails = 0
nFails = 0 nFails = 0
nFailsBeforePing = 0 nFailsBeforePing = 0
eventSource = null eventSource = null
@ -90,7 +98,8 @@ object FailureHandler {
} }
fun getDebugInfo(): String { fun getDebugInfo(): String {
return "nFails: $nFails\n" + return "ttlFails: $ttlFails\n" +
"nFails: $nFails\n" +
"nFailsBeforePing: $nFailsBeforePing\n" + "nFailsBeforePing: $nFailsBeforePing\n" +
"eventSource null: ${eventSource == null}" "eventSource null: ${eventSource == null}"
} }