From d0c9c30cde24cf86588c44699052217ea564311f Mon Sep 17 00:00:00 2001 From: Tyler Heck Date: Wed, 30 Dec 2020 08:15:26 -0700 Subject: [PATCH] Add initial delay of twenty seconds to sync worker enqueue --- .../src/main/java/com/automattic/simplenote/Simplenote.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Simplenote/src/main/java/com/automattic/simplenote/Simplenote.java b/Simplenote/src/main/java/com/automattic/simplenote/Simplenote.java index 1a0c7e5ba..9ff34d6b8 100644 --- a/Simplenote/src/main/java/com/automattic/simplenote/Simplenote.java +++ b/Simplenote/src/main/java/com/automattic/simplenote/Simplenote.java @@ -53,6 +53,7 @@ public class Simplenote extends Application implements HeartbeatListener { public static final int INTENT_PREFERENCES = 1; public static final int ONE_MINUTE_MILLIS = 60 * 1000; // 60 seconds public static final int TEN_SECONDS_MILLIS = 10 * 1000; // 10 seconds + public static final int TWENTY_SECONDS_MILLIS = 20 * 1000; // 20 seconds private static final String AUTH_PROVIDER = "simplenote.com"; private static final String TAG_SYNC = "sync"; @@ -219,6 +220,7 @@ public void run() { ) .setConstraints(new Constraints.Builder().setRequiredNetworkType(NetworkType.CONNECTED).build()) .setBackoffCriteria(BackoffPolicy.LINEAR, ONE_MINUTE_MILLIS, TimeUnit.MILLISECONDS) + .setInitialDelay(TWENTY_SECONDS_MILLIS, TimeUnit.MILLISECONDS) .addTag(TAG_SYNC) .build(); WorkManager.getInstance(getApplicationContext()).enqueueUniquePeriodicWork(