From 670a5d8b20017c42b92bf6ce264c2eef11eba0ad Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 11 Mar 2021 10:21:17 +0100 Subject: [PATCH] Retry finding cross account moved message --- app/src/main/java/eu/faircode/email/Core.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index 1cb6990faf..6097592776 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -155,6 +155,8 @@ class Core { private static final int TOTAL_RETRY_MAX = LOCAL_RETRY_MAX * 5; private static final int MAX_PREVIEW = 5000; // characters private static final long EXISTS_RETRY_DELAY = 20 * 1000L; // milliseconds + private static final int FIND_RETRY_COUNT = 3; // times + private static final long FIND_RETRY_DELAY = 5 * 1000L; // milliseconds static void processOperations( Context context, @@ -1026,7 +1028,17 @@ class Core { } } else { // Lookup added messages - Long found = findUid(context, ifolder, message.msgid, false); + int count = 0; + Long found = null; + while (found == null && count++ < FIND_RETRY_COUNT) { + found = findUid(context, ifolder, message.msgid, false); + if (found == null) + try { + Thread.sleep(FIND_RETRY_DELAY); + } catch (InterruptedException ex) { + Log.e(ex); + } + } try { db.beginTransaction();