diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/traccar/schedule/TaskHealthCheck.java | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/main/java/org/traccar/schedule/TaskHealthCheck.java b/src/main/java/org/traccar/schedule/TaskHealthCheck.java index b3387eca7..56ac4b91d 100644 --- a/src/main/java/org/traccar/schedule/TaskHealthCheck.java +++ b/src/main/java/org/traccar/schedule/TaskHealthCheck.java @@ -97,17 +97,17 @@ public class TaskHealthCheck implements ScheduleTask { LOGGER.warn("Web health check failed with status {}", status); } - if (dropThreshold > 0) { - int messageCurrentTotal = statisticsManager.messageStoredCount(); - int messageCurrentPeriod = messageCurrentTotal - messageLastTotal; + int messageCurrentTotal = statisticsManager.messageStoredCount(); + int messageCurrentPeriod = messageCurrentTotal - messageLastTotal; + if (dropThreshold > 0 && messageLastPeriod > 0) { double drop = messageCurrentPeriod / (double) messageLastPeriod; if (drop < dropThreshold) { success = false; LOGGER.warn("Message health check failed with drop {}", drop); } - messageLastTotal = messageCurrentTotal; - messageLastPeriod = messageCurrentPeriod; } + messageLastTotal = messageCurrentTotal; + messageLastPeriod = messageCurrentPeriod; if (success) { notifyWatchdog(); |