Update retryable

Per Jeff, don't handle CDS requests yet.
pull/1/head
Michael Kirk 7 years ago
parent 0598733fc6
commit f002f89f2c

@ -249,7 +249,9 @@ class CDSBatchOperation: OWSOperation {
}
private func attestationFailure(error: Error) {
self.reportError(ContactDiscoveryError.attestationError(underlyingError: error))
let attestationError: NSError = ContactDiscoveryError.attestationError(underlyingError: error) as NSError
attestationError.isRetryable = false
self.reportError(attestationError)
}
private func makeContactDiscoveryRequest(remoteAttestation: RemoteAttestation) {
@ -295,9 +297,11 @@ class CDSBatchOperation: OWSOperation {
return
}
// TODO CDS ratelimiting
guard response.statusCode != 413 else {
let rateLimitError = OWSErrorWithCodeDescription(OWSErrorCode.contactsUpdaterRateLimit, "Contacts Intersection Rate Limit")
let rateLimitError: NSError = OWSErrorWithCodeDescription(OWSErrorCode.contactsUpdaterRateLimit, "Contacts Intersection Rate Limit") as NSError
// TODO CDS ratelimiting, handle Retry-After header if available
rateLimitError.isRetryable = false
self.reportError(rateLimitError)
return
}
@ -312,6 +316,8 @@ class CDSBatchOperation: OWSOperation {
guard response.statusCode / 100 != 5 else {
let serverError = ContactDiscoveryError.serverError(underlyingError: error) as NSError
serverError.isRetryable = (error as NSError).isRetryable
// TODO CDS ratelimiting, handle Retry-After header if available
self.reportError(serverError)
return
}

@ -200,11 +200,13 @@ typedef void (^failureBlock)(NSURLSessionDataTask *task, NSError *error);
case 403: {
DDLogError(
@"The server returned an authentication failure: %@, %@", networkError.debugDescription, request);
error.isRetryable = NO;
failureBlock(task, error);
break;
}
case 404: {
DDLogError(@"The requested resource could not be found: %@, %@", networkError.debugDescription, request);
error.isRetryable = NO;
failureBlock(task, error);
break;
}

Loading…
Cancel
Save