From 0a7fe27ca1f3c653384305d798539a87d716f729 Mon Sep 17 00:00:00 2001 From: sim Date: Tue, 30 May 2023 22:56:52 +0200 Subject: [PATCH] Count fails since service start --- .../distributor/nextpush/services/FailureHandler.kt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/unifiedpush/distributor/nextpush/services/FailureHandler.kt b/app/src/main/java/org/unifiedpush/distributor/nextpush/services/FailureHandler.kt index 42c666e..3ee6e73 100644 --- a/app/src/main/java/org/unifiedpush/distributor/nextpush/services/FailureHandler.kt +++ b/app/src/main/java/org/unifiedpush/distributor/nextpush/services/FailureHandler.kt @@ -11,8 +11,15 @@ import org.unifiedpush.distributor.nextpush.utils.TAG object FailureHandler { + private var ttlFails = 0 + var nFails = 0 - private set + private set(value) { + if (value > 0) { + ttlFails += 1 + } + field = value + } private var nFailsBeforePing = 0 @@ -79,6 +86,7 @@ object FailureHandler { } fun clearFails() { + ttlFails = 0 nFails = 0 nFailsBeforePing = 0 eventSource = null @@ -90,7 +98,8 @@ object FailureHandler { } fun getDebugInfo(): String { - return "nFails: $nFails\n" + + return "ttlFails: $ttlFails\n" + + "nFails: $nFails\n" + "nFailsBeforePing: $nFailsBeforePing\n" + "eventSource null: ${eventSource == null}" }