From a3342c29b2920978c2fb3e6db2058113d0ad4c46 Mon Sep 17 00:00:00 2001 From: Matthew Date: Fri, 12 Jul 2024 23:42:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8D=95=E4=BD=8D=E4=B8=8D?= =?UTF-8?q?=E7=BB=9F=E4=B8=80=E5=AF=BC=E8=87=B4=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/xypower/mpmaster/MpMasterService.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mpmaster/src/main/java/com/xypower/mpmaster/MpMasterService.java b/mpmaster/src/main/java/com/xypower/mpmaster/MpMasterService.java index fa8ca629..444d77a9 100644 --- a/mpmaster/src/main/java/com/xypower/mpmaster/MpMasterService.java +++ b/mpmaster/src/main/java/com/xypower/mpmaster/MpMasterService.java @@ -93,7 +93,7 @@ public class MpMasterService extends Service { private static int mStateService = STATE_SERVICE.NOT_CONNECTED; - private int mMpHeartbeatDuration = 10; // Unit: minute + private long mMpHeartbeatDuration = 600000; // = 10minutes Unit: millssecond private boolean mMntnMode = false; private boolean mQuickHbMode = false; @@ -472,7 +472,7 @@ public class MpMasterService extends Service { MicroPhotoContext.AppConfig appConfig = MicroPhotoContext.getMpAppConfig(getApplicationContext()); if (appConfig.heartbeat > 0) { - mMpHeartbeatDuration = appConfig.heartbeat; + mMpHeartbeatDuration = appConfig.heartbeat * 60000; } logger.warning("Start Mntn report: " + masterUrl + " MntnMode=" + (mMntnMode ? "1" : "0") + " QuickHB=" + (mQuickHbMode ? "1" : "0")); @@ -512,7 +512,7 @@ public class MpMasterService extends Service { mService.mPreviousMpHbTime = System.currentTimeMillis(); if (intent.hasExtra("HeartbeatDuration")) { - mService.mMpHeartbeatDuration = intent.getIntExtra("HeartbeatDuration", 10); + mService.mMpHeartbeatDuration = intent.getIntExtra("HeartbeatDuration", 600000); } mService.logger.info("Heartbeat Timer Fired By MpAPP ACTION=" + action); @@ -632,9 +632,9 @@ public class MpMasterService extends Service { } } - if (zeroPoint + closestTime * 1000 > currentTimeMs + mMpHeartbeatDuration * 60000) { + if (zeroPoint + closestTime * 1000 > currentTimeMs + mMpHeartbeatDuration) { keepAlive = true; - registerHeartbeatTimer(currentTimeMs + mMpHeartbeatDuration * 60000 + 5000, keepAlive); + registerHeartbeatTimer(currentTimeMs + mMpHeartbeatDuration + 5000, keepAlive); } else { registerHeartbeatTimer(zeroPoint + closestTime * 1000, keepAlive); }