From d68e9b2972bbdeb7139f2c4a42307f144c2f342b Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 14 Aug 2024 10:11:43 +0200 Subject: [PATCH] Revert "Skip cancelling work" This reverts commit 68e45b321bb3726b46fa4cf483b987409e307c8d. --- app/src/main/java/eu/faircode/email/WorkerDailyRules.java | 1 + app/src/main/java/eu/faircode/email/WorkerSync.java | 1 + 2 files changed, 2 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/WorkerDailyRules.java b/app/src/main/java/eu/faircode/email/WorkerDailyRules.java index 5d32badd0a..3bed00d52d 100644 --- a/app/src/main/java/eu/faircode/email/WorkerDailyRules.java +++ b/app/src/main/java/eu/faircode/email/WorkerDailyRules.java @@ -154,6 +154,7 @@ public class WorkerDailyRules extends Worker { delay = cal.getTimeInMillis() - now; EntityLog.log(context, EntityLog.Type.Rules, "Queuing " + getName() + " delay=" + (delay / (60 * 1000L)) + "m"); + WorkManager.getInstance(context).cancelUniqueWork(getName()); PeriodicWorkRequest.Builder builder = new PeriodicWorkRequest.Builder(WorkerDailyRules.class, 1, TimeUnit.DAYS) .setInitialDelay(delay, TimeUnit.MILLISECONDS); diff --git a/app/src/main/java/eu/faircode/email/WorkerSync.java b/app/src/main/java/eu/faircode/email/WorkerSync.java index 7a2e84fee3..bf7c8fd4e7 100644 --- a/app/src/main/java/eu/faircode/email/WorkerSync.java +++ b/app/src/main/java/eu/faircode/email/WorkerSync.java @@ -92,6 +92,7 @@ public class WorkerSync extends Worker { EntityLog.log(context, EntityLog.Type.Cloud, "Queuing " + getName() + " delay=" + (delay / (60 * 1000L)) + "m"); + WorkManager.getInstance(context).cancelUniqueWork(getName()); PeriodicWorkRequest.Builder builder = new PeriodicWorkRequest.Builder(WorkerSync.class, 1, TimeUnit.DAYS) .setInitialDelay(delay, TimeUnit.MILLISECONDS)