重启MpAPP逻辑优化

TempBranch
Matthew 8 months ago
parent e3150e8f1a
commit 32573af5b0

@ -459,6 +459,7 @@ public class MpMasterService extends Service {
((ts - modifiedTimeOfPhoto) > mTimeOfMpAppAlive * 4) ||
((ts - modifiedTimeOfUpload) > mTimeOfMpAppAlive * 4)) {
if (ts - mTimeToStartMpApp >= 30000) {
String msg = "Restart MpAPP as it is NOT Running hb=" + Long.toString(ts - modifiedTimeOfHb) +
" taking=" + Long.toString(ts - modifiedTimeOfPhoto) + " sending=" + Long.toString(ts - modifiedTimeOfUpload) +
" Will restart MpApp in " + Long.toString(mDelayedRestartMpTime / 1000) + " seconds";
@ -472,6 +473,9 @@ public class MpMasterService extends Service {
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT);
alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, ts + mDelayedRestartMpTime, pendingIntent);
mTimeToStartMpApp = ts;
}
}
} catch (Exception ex) {
ex.printStackTrace();
@ -624,7 +628,8 @@ public class MpMasterService extends Service {
if (intent.hasExtra("HeartbeatDuration")) {
mService.mMpHeartbeatDuration = intent.getIntExtra("HeartbeatDuration", 600000);
int hbDuration = intent.getIntExtra("HeartbeatDuration", 600000);
mService.mMpHeartbeatDuration = hbDuration > 0 ? hbDuration : 600000;
}
mService.mPreviousMpHbTime = intent.getLongExtra("HeartbeatTime", System.currentTimeMillis());
mService.logger.info("Heartbeat Timer Fired By MpAPP ACTION=" + action + " MpHB=" + Long.toString(mService.mMpHeartbeatDuration));

Loading…
Cancel
Save