From 933be540357a957885af8490faf5ca5b1d52e5b6 Mon Sep 17 00:00:00 2001 From: Greyson Parrelli Date: Wed, 20 Jun 2018 13:56:05 -0700 Subject: [PATCH] Update scheduling of ServiceOutageDetectionJob. Previously, we were running this job in PushSendJob#onCanceled(). However, with the new retry logic, this won't happen for 24 hours. Instead, we now schedule the job in PushSendJob#onRetry(). --- src/org/thoughtcrime/securesms/jobs/PushGroupSendJob.java | 2 -- src/org/thoughtcrime/securesms/jobs/PushMediaSendJob.java | 2 -- src/org/thoughtcrime/securesms/jobs/PushSendJob.java | 8 ++++++-- src/org/thoughtcrime/securesms/jobs/PushTextSendJob.java | 2 -- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/org/thoughtcrime/securesms/jobs/PushGroupSendJob.java b/src/org/thoughtcrime/securesms/jobs/PushGroupSendJob.java index b649a4efc1..af31833c79 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushGroupSendJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushGroupSendJob.java @@ -139,8 +139,6 @@ public class PushGroupSendJob extends PushSendJob implements InjectableType { @Override public void onCanceled() { - super.onCanceled(); - DatabaseFactory.getMmsDatabase(context).markAsSentFailed(messageId); } diff --git a/src/org/thoughtcrime/securesms/jobs/PushMediaSendJob.java b/src/org/thoughtcrime/securesms/jobs/PushMediaSendJob.java index eb1fae63cb..51ed31232f 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushMediaSendJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushMediaSendJob.java @@ -94,8 +94,6 @@ public class PushMediaSendJob extends PushSendJob implements InjectableType { @Override public void onCanceled() { - super.onCanceled(); - DatabaseFactory.getMmsDatabase(context).markAsSentFailed(messageId); notifyMediaMessageDeliveryFailed(context, messageId); } diff --git a/src/org/thoughtcrime/securesms/jobs/PushSendJob.java b/src/org/thoughtcrime/securesms/jobs/PushSendJob.java index 9d3bb631ca..8cca4dd4e1 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushSendJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushSendJob.java @@ -74,8 +74,12 @@ public abstract class PushSendJob extends SendJob { } @Override - public void onCanceled() { - ApplicationContext.getInstance(context).getJobManager().add(new ServiceOutageDetectionJob(context)); + public void onRetry() { + super.onRetry(); + + if (getRunIteration() > 1) { + ApplicationContext.getInstance(context).getJobManager().add(new ServiceOutageDetectionJob(context)); + } } protected Optional getProfileKey(@NonNull Recipient recipient) { diff --git a/src/org/thoughtcrime/securesms/jobs/PushTextSendJob.java b/src/org/thoughtcrime/securesms/jobs/PushTextSendJob.java index 9efc8895f8..58b3967c43 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushTextSendJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushTextSendJob.java @@ -83,8 +83,6 @@ public class PushTextSendJob extends PushSendJob implements InjectableType { @Override public void onCanceled() { - super.onCanceled(); - DatabaseFactory.getSmsDatabase(context).markAsSentFailed(messageId); long threadId = DatabaseFactory.getSmsDatabase(context).getThreadIdForMessage(messageId);