增加长时间无心跳重启app的机制,并优化运维日志

lowmem
Matthew 2 months ago
parent 3fab6d4542
commit d23116aa57

@ -444,18 +444,29 @@ public class MpMasterService extends Service {
} }
long tempduration = mMpHeartbeatDuration; long tempduration = mMpHeartbeatDuration;
if (mMpHeartbeatDuration < 600000) if (mMpHeartbeatDuration < 600000) {
tempduration = 290000; tempduration = 600000;
if (mPreviousMpHbTime <= ts && ts - mPreviousMpHbTime > tempduration * 2) { }
if (mPreviousMpHbTime <= ts && (ts - mPreviousMpHbTime) > tempduration * 3) {
// MpApp is not running // MpApp is not running
if (ts - mTimeToStartMpApp >= 1800000) { // 30 minutes 30 * 60 * 1000 if (ts - mTimeToStartMpApp >= 1800000) { // 30 minutes 30 * 60 * 1000
if (false) {
MpMasterService.restartMpApp(context.getApplicationContext(), "MpMST Keep Alive Detection"); MpMasterService.restartMpApp(context.getApplicationContext(), "MpMST Keep Alive Detection");
}
String prevMpHBTime = "";
String prevRestartTime = "";
try {
SimpleDateFormat format = new SimpleDateFormat("MM-dd HH:mm:ss");
Date date = new Date(mPreviousMpHbTime);
prevMpHBTime = format.format(date);
Date date2 = new Date(mTimeToStartMpApp);
prevRestartTime = format.format(date2);
} catch (Exception ex) {
ex.printStackTrace();
}
logger.warning("Restart MpAPP as it is NOT Running Prev MPAPP HB=" + logger.warning("Restart MpAPP as it is NOT Running Prev MPAPP HB=" +
Long.toString((ts - mPreviousMpHbTime) / 1000) + " MPAPP HBDuration=" + Long.toString(mMpHeartbeatDuration) Long.toString((ts - mPreviousMpHbTime) / 1000) + " MPAPP HBDuration=" + Long.toString(tempduration)
+ " Prev MpRestart Time=" + Long.toString(mTimeToStartMpApp) + " last MPAPPHB =" + (mPreviousMpHbTime / 1000)); + " Prev MpRestart Time=" + prevRestartTime + " last MPAPPHB =" + prevMpHBTime);
mTimeToStartMpApp = ts; mTimeToStartMpApp = ts;
} else { } else {

Loading…
Cancel
Save