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().
This commit is contained in:
Greyson Parrelli 2018-06-20 13:56:05 -07:00
parent f1d8fd8838
commit 933be54035
4 changed files with 6 additions and 8 deletions

View File

@ -139,8 +139,6 @@ public class PushGroupSendJob extends PushSendJob implements InjectableType {
@Override
public void onCanceled() {
super.onCanceled();
DatabaseFactory.getMmsDatabase(context).markAsSentFailed(messageId);
}

View File

@ -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);
}

View File

@ -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<byte[]> getProfileKey(@NonNull Recipient recipient) {

View File

@ -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);