Commit f2198266 by pye52

保证启动时会清理掉上一次的任务

parent c8a3b955
......@@ -2,6 +2,7 @@ package com.bgycc.smartcanteen.utils;
import android.content.Context;
import androidx.work.ExistingWorkPolicy;
import androidx.work.PeriodicWorkRequest;
import androidx.work.WorkManager;
......@@ -19,6 +20,7 @@ public class WorkerUtils {
// 每隔一定时间检查日志文件夹并进行清理
public static void startLogFilesMonitor(Context context) {
stopLogFilesMonitor(context);
PeriodicWorkRequest request = new PeriodicWorkRequest.Builder(LogFileMonitor.class, LOG_REPEAT_INTERVAL, TimeUnit.HOURS)
.addTag(LOG_MONITOR_WORKER)
.build();
......@@ -33,6 +35,7 @@ public class WorkerUtils {
// 每隔一定时间检查数据库并进行清理
public static void startDatabaseMonitor(Context context) {
stopDatabaseMonitor(context);
PeriodicWorkRequest request = new PeriodicWorkRequest.Builder(DatabaseMonitor.class, DATABASE_REPEAT_INTERVAL, TimeUnit.HOURS)
.addTag(DATABASE_MONITOR_WORKER)
.build();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment