1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

Tempfail outgoing messages after 5 delivery attempts

This commit is contained in:
Jesse Vincent 2011-03-09 22:42:54 -05:00
parent 2affa9d52b
commit a54cf7a757
2 changed files with 15 additions and 0 deletions

View File

@ -245,6 +245,13 @@ public class K9 extends Application {
*/
public static final int MAX_ATTACHMENT_DOWNLOAD_SIZE = (128 * 1024 * 1024);
/* How many times should K-9 try to deliver a message before giving up
* until the app is killed and restarted
*/
public static int MAX_SEND_ATTEMPTS = 5;
/**
* Max time (in millis) the wake lock will be held for when background sync is happening
*/

View File

@ -3011,6 +3011,14 @@ public class MessagingController implements Runnable {
if (K9.DEBUG)
Log.i(K9.LOG_TAG, "Send count for message " + message.getUid() + " is " + count.get());
if (count.incrementAndGet() > K9.MAX_SEND_ATTEMPTS) {
Log.e(K9.LOG_TAG, "Send count for message " + message.getUid() + " can't be delivered after "+ K9.MAX_SEND_ATTEMPTS + " attempts. Giving up until the user restarts the device");
notifySendTempFailed(account, new MessagingException(message.getSubject()));
continue;
}
localFolder.fetch(new Message[] { message }, fp, null);
try {
message.setFlag(Flag.X_SEND_IN_PROGRESS, true);