From 3dba87198a9d8460c777f04d83a08fc59bbf9058 Mon Sep 17 00:00:00 2001 From: Mikunj Date: Fri, 13 Sep 2019 11:56:36 +1000 Subject: [PATCH] Fix messages infinitely sending. This was because signal infinitely tries to send message on network errors. Since we already have retrying built into the loki api we just disable this behaviour and set a cap of 3 on PushSendJobs incase. --- src/org/thoughtcrime/securesms/jobs/PushGroupSendJob.java | 4 +++- src/org/thoughtcrime/securesms/jobs/PushMediaSendJob.java | 3 ++- src/org/thoughtcrime/securesms/jobs/PushSendJob.java | 2 +- src/org/thoughtcrime/securesms/jobs/PushTextSendJob.java | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/org/thoughtcrime/securesms/jobs/PushGroupSendJob.java b/src/org/thoughtcrime/securesms/jobs/PushGroupSendJob.java index 939648f893..92c0827ccd 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushGroupSendJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushGroupSendJob.java @@ -215,7 +215,9 @@ public class PushGroupSendJob extends PushSendJob implements InjectableType { @Override public boolean onShouldRetry(@NonNull Exception exception) { if (exception instanceof IOException) return true; - if (exception instanceof RetryLaterException) return true; + + // Loki - Disable since we have our own retrying + // if (exception instanceof RetryLaterException) return true; return false; } diff --git a/src/org/thoughtcrime/securesms/jobs/PushMediaSendJob.java b/src/org/thoughtcrime/securesms/jobs/PushMediaSendJob.java index ab0a497b72..3f384fff8f 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushMediaSendJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushMediaSendJob.java @@ -179,7 +179,8 @@ public class PushMediaSendJob extends PushSendJob implements InjectableType { @Override public boolean onShouldRetry(@NonNull Exception exception) { - if (exception instanceof RetryLaterException) return true; + // Loki - Disable since we have our own retrying + // if (exception instanceof RetryLaterException) return true; return false; } diff --git a/src/org/thoughtcrime/securesms/jobs/PushSendJob.java b/src/org/thoughtcrime/securesms/jobs/PushSendJob.java index d272f26768..e64db9029a 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushSendJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushSendJob.java @@ -68,7 +68,7 @@ public abstract class PushSendJob extends SendJob { .setQueue(destination.serialize()) .addConstraint(NetworkConstraint.KEY) .setLifespan(TimeUnit.DAYS.toMillis(1)) - .setMaxAttempts(Parameters.UNLIMITED) + .setMaxAttempts(3) .build(); } diff --git a/src/org/thoughtcrime/securesms/jobs/PushTextSendJob.java b/src/org/thoughtcrime/securesms/jobs/PushTextSendJob.java index 619385bc1b..ddb4f47e86 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushTextSendJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushTextSendJob.java @@ -134,7 +134,8 @@ public class PushTextSendJob extends PushSendJob implements InjectableType { @Override public boolean onShouldRetry(@NonNull Exception exception) { - if (exception instanceof RetryLaterException) return true; + // Loki - Disable since we have our own retrying + // if (exception instanceof RetryLaterException) return true; return false; }