增加保活检测时间可配置

serial
Matthew 1 year ago
parent a50f913d1e
commit 225fe2cd7f

@ -53,6 +53,7 @@ public class MicroPhotoContext {
public int heartbeat; // Unit minute public int heartbeat; // Unit minute
public int[] absHeartbeats; // second public int[] absHeartbeats; // second
public int separateNetwork; public int separateNetwork;
public int mpappMonitorTimeout = 30 * 60000; // 30 minutes
public String getUrl() { public String getUrl() {
if (TextUtils.isEmpty(server)) { if (TextUtils.isEmpty(server)) {
@ -241,6 +242,12 @@ public class MicroPhotoContext {
masterConfig.quickHbMode = jsonObject.optInt("quickHbMode", 0); masterConfig.quickHbMode = jsonObject.optInt("quickHbMode", 0);
masterConfig.usingAbsHbTime = jsonObject.optInt("usingAbsHbTime", 0); masterConfig.usingAbsHbTime = jsonObject.optInt("usingAbsHbTime", 0);
masterConfig.separateNetwork = jsonObject.optInt("separateNetwork", 0); masterConfig.separateNetwork = jsonObject.optInt("separateNetwork", 0);
// masterConfig.mpappMonitorTimeout = jsonObject.optInt("mpappMonitorTimeout", 30 * 60000);
int mpappMonitorTimeout = jsonObject.optInt("mpappMonitorTimeout", 30 * 60000);
if (mpappMonitorTimeout >= 4 * 60000 && mpappMonitorTimeout <= 35 * 60000) {
masterConfig.mpappMonitorTimeout = mpappMonitorTimeout;
}
// long defaultHearbeat = masterConfig.separateNetwork == 0 ? DEFAULT_HEARTBEAT_FOR_SHARED_NW : DEFAULT_HEARTBEAT_FOR_SEPARATE_NW; // long defaultHearbeat = masterConfig.separateNetwork == 0 ? DEFAULT_HEARTBEAT_FOR_SHARED_NW : DEFAULT_HEARTBEAT_FOR_SEPARATE_NW;
masterConfig.heartbeat = jsonObject.optInt("heartbeat", DEFAULT_HEARTBEAT_FOR_SHARED_NW); masterConfig.heartbeat = jsonObject.optInt("heartbeat", DEFAULT_HEARTBEAT_FOR_SHARED_NW);
if (jsonObject.has("absHeartbeats")) { if (jsonObject.has("absHeartbeats")) {

@ -219,6 +219,7 @@ public class MpMasterService extends Service {
mHeartbeatDuration = masterConfig.heartbeat * 10; // minute to second mHeartbeatDuration = masterConfig.heartbeat * 10; // minute to second
mAbsHeartbeatTimes = masterConfig.absHeartbeats; mAbsHeartbeatTimes = masterConfig.absHeartbeats;
mSeparateNetwork = masterConfig.separateNetwork != 0; mSeparateNetwork = masterConfig.separateNetwork != 0;
mTimeOfMpAppAlive = masterConfig.mpappMonitorTimeout;
} }
// public boolean useSeparater // public boolean useSeparater

Loading…
Cancel
Save