[2.13.2][fix]解决数据库崩溃的问题

This commit is contained in:
chenfufeng
2023-01-11 15:44:34 +08:00
parent 13cebf3b06
commit 7cad199cfd

View File

@@ -123,7 +123,25 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
}).start();
}
// TODO 李小鹏 这里需要将逻辑抽离出去,单独使用更新服务控制
private void checkMonitorDb() {
new Thread(() -> {
long limitId = 50001;
File file = this.getDatabasePath(MonitorDb.INTERNAL_DB_NAME);
try {
if (file != null && file.exists()) {
List<CpuInfo> cpuList = MonitorDb.getDb(this).monitorDao().getAllCPUById(limitId);
List<MemInfo> memList = MonitorDb.getDb(this).monitorDao().getAllMemById(limitId);
// 大于5w条清除
if (cpuList.size() > 0 || memList.size() > 0) {
this.deleteDatabase(MonitorDb.INTERNAL_DB_NAME);
}
}
} catch (Exception e) {
CallerLogger.INSTANCE.e(TAG, e.getMessage());
}
}).start();
}
private void upgradeProgressListener() {
final NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
// builder.setSmallIcon(R.mipmap.icon1001);//todo emArrow 更换图标,去除地图下载图标的依赖关系