push_notifications: Handle BrokenPipeError from APNS.

This seems to happen when Apple is having a partial outage on some of
their APNS shards; it should be treated like other networking errors
connecting to APNS (with an automatic retry).
This commit is contained in:
Tim Abbott 2018-12-05 10:02:18 -08:00
parent 196ec78261
commit d723dbfef7
1 changed files with 4 additions and 0 deletions

View File

@ -143,6 +143,10 @@ def send_apple_push_notification(user_id: int, devices: List[DeviceToken],
logger.warning("APNs: HTTP error sending for user %d to device %s: %s", logger.warning("APNs: HTTP error sending for user %d to device %s: %s",
user_id, device.token, e.__class__.__name__) user_id, device.token, e.__class__.__name__)
return None return None
except BrokenPipeError as e:
logger.warning("APNs: HTTP BrokenPipeError error sending for user %d to device %s: %s",
user_id, device.token, e.__class__.__name__)
return None
result = attempt_send() result = attempt_send()
while result is None and retries_left > 0: while result is None and retries_left > 0: