优化运维重启MpAPP机制

MQTTtest
Matthew 9 months ago
parent 611cfcbb3a
commit 28bb7cf1ed

@ -359,15 +359,17 @@ public class MpMasterService extends Service {
try { try {
final Context context = getApplicationContext(); final Context context = getApplicationContext();
if (MicroPhotoContext.isAppAlive(context, MicroPhotoContext.PACKAGE_NAME_MPAPP)) { if (!MicroPhotoContext.isAppAlive(context, MicroPhotoContext.PACKAGE_NAME_MPAPP)) {
logger.warning("MpAPP is STILL Running"); MicroPhotoContext.restartMpApp(context);
mTimeToStartMpApp = System.currentTimeMillis();
logger.warning("Restart MpAPP as it is NOT Running");
return; return;
} }
final String appPath = MicroPhotoContext.buildMpAppDir(context); final String appPath = MicroPhotoContext.buildMpAppDir(context);
final long ts = System.currentTimeMillis(); final long ts = System.currentTimeMillis();
if (ts - mTimeToStartMpApp < 30000) { if (ts - mTimeToStartMpApp < 30000) {
logger.warning("MpAPP has restarted in 30s"); logger.warning("MpAPP has restarted in 30s, skip the check.");
return; return;
} }

Loading…
Cancel
Save