Wait 5 seconds between SMTP retries

This commit is contained in:
M66B 2023-09-10 20:21:13 +02:00
parent a16bb54c4a
commit ebaa37e427
1 changed files with 5 additions and 2 deletions

View File

@ -93,6 +93,7 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
Helper.getBackgroundExecutor(1, "send"); Helper.getBackgroundExecutor(1, "send");
private static final int RETRY_MAX = 3; 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 CONNECTIVITY_DELAY = 5000; // milliseconds
private static final int PROGRESS_UPDATE_INTERVAL = 1000; // 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); Log.e(outbox.name, ex);
EntityLog.log(this, "Send " + Log.formatThrowable(ex, false)); 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 OutOfMemoryError ||
ex instanceof MessageRemovedException || ex instanceof MessageRemovedException ||
ex instanceof FileNotFoundException || ex instanceof FileNotFoundException ||
@ -516,8 +517,10 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
Log.w("Unrecoverable"); Log.w("Unrecoverable");
db.operation().deleteOperation(op.id); db.operation().deleteOperation(op.id);
ops.remove(op); ops.remove(op);
} else } else {
Thread.sleep(RETRY_WAIT);
throw ex; throw ex;
}
} finally { } finally {
EntityLog.log(this, "Send end op=" + op.id + "/" + op.name); EntityLog.log(this, "Send end op=" + op.id + "/" + op.name);
db.operation().setOperationState(op.id, null); db.operation().setOperationState(op.id, null);