Don't allow rate limit responses to end all group sends.

This commit is contained in:
Cody Henthorne
2022-02-28 11:00:20 -05:00
committed by Alex Hart
parent 0ddfb4456b
commit e701e4bff0
7 changed files with 73 additions and 23 deletions

View File

@@ -405,8 +405,13 @@ public final class PushGroupSendJob extends PushSendJob {
RetrieveProfileJob.enqueue(mismatchRecipientIds);
} else if (!networkFailures.isEmpty()) {
Log.w(TAG, "Retrying because there were " + networkFailures.size() + " network failures.");
throw new RetryLaterException();
long retryAfter = results.stream()
.filter(r -> r.getRateLimitFailure() != null)
.map(r -> r.getRateLimitFailure().getRetryAfterMilliseconds().or(-1L))
.max(Long::compare)
.orElse(-1L);
Log.w(TAG, "Retrying because there were " + networkFailures.size() + " network failures. retryAfter: " + retryAfter);
throw new RetryLaterException(retryAfter);
}
}