Unrecoverable sends will not be retried

pull/191/head
M66B 4 years ago
parent 968f0ce68a
commit 9c77f3ea43

@ -389,27 +389,29 @@ 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 ||
ex instanceof OutOfMemoryError ||
ex instanceof MessageRemovedException ||
ex instanceof FileNotFoundException ||
(ex instanceof AuthenticationFailedException && !ConnectionHelper.isIoError(ex)) ||
ex instanceof SendFailedException ||
ex instanceof IllegalArgumentException);
db.operation().setOperationError(op.id, Log.formatThrowable(ex)); db.operation().setOperationError(op.id, Log.formatThrowable(ex));
if (message != null) { if (message != null) {
db.message().setMessageError(message.id, Log.formatThrowable(ex)); db.message().setMessageError(message.id, Log.formatThrowable(ex));
try { try {
int tries_left = (unrecoverable ? 0 : RETRY_MAX - op.tries);
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
nm.notify("send:" + message.id, 1, getNotificationError( nm.notify("send:" + message.id, 1, getNotificationError(
MessageHelper.formatAddressesShort(message.to), ex, RETRY_MAX - op.tries).build()); MessageHelper.formatAddressesShort(message.to), ex, tries_left).build());
} catch (Throwable ex1) { } catch (Throwable ex1) {
Log.w(ex1); Log.w(ex1);
} }
} }
if (op.tries >= RETRY_MAX || if (unrecoverable) {
ex instanceof OutOfMemoryError ||
ex instanceof MessageRemovedException ||
ex instanceof FileNotFoundException ||
(ex instanceof AuthenticationFailedException &&
!ConnectionHelper.isIoError(ex)) ||
ex instanceof SendFailedException ||
ex instanceof IllegalArgumentException) {
Log.w("Unrecoverable"); Log.w("Unrecoverable");
db.operation().deleteOperation(op.id); db.operation().deleteOperation(op.id);
ops.remove(op); ops.remove(op);

Loading…
Cancel
Save