From ebaa37e427b21bfb19b917e564d73d7bbbff9f15 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 10 Sep 2023 20:21:13 +0200 Subject: [PATCH] Wait 5 seconds between SMTP retries --- app/src/main/java/eu/faircode/email/ServiceSend.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ServiceSend.java b/app/src/main/java/eu/faircode/email/ServiceSend.java index 43dca77fdf..bd0da12208 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSend.java +++ b/app/src/main/java/eu/faircode/email/ServiceSend.java @@ -93,6 +93,7 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar Helper.getBackgroundExecutor(1, "send"); private static final int RETRY_MAX = 3; + private static final long RETRY_WAIT = 5000L; // milliseconds private static final int CONNECTIVITY_DELAY = 5000; // milliseconds private static final int PROGRESS_UPDATE_INTERVAL = 1000; // milliseconds @@ -451,7 +452,7 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar Log.e(outbox.name, ex); EntityLog.log(this, "Send " + Log.formatThrowable(ex, false)); - boolean unrecoverable = (op.tries >= RETRY_MAX || + boolean unrecoverable = (op.tries > RETRY_MAX || ex instanceof OutOfMemoryError || ex instanceof MessageRemovedException || ex instanceof FileNotFoundException || @@ -516,8 +517,10 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar Log.w("Unrecoverable"); db.operation().deleteOperation(op.id); ops.remove(op); - } else + } else { + Thread.sleep(RETRY_WAIT); throw ex; + } } finally { EntityLog.log(this, "Send end op=" + op.id + "/" + op.name); db.operation().setOperationState(op.id, null);