From f10683490028bb459c18dfaa071293ea9bad3e1a Mon Sep 17 00:00:00 2001 From: Samuel Clay Date: Thu, 4 May 2017 17:38:58 -0700 Subject: [PATCH] Adding error handling for APNS. --- apps/notifications/models.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/notifications/models.py b/apps/notifications/models.py index 7d17696ce..a46013517 100644 --- a/apps/notifications/models.py +++ b/apps/notifications/models.py @@ -237,6 +237,11 @@ class MUserFeedNotification(mongo.Document): image_url = story['image_urls'][0] # print image_url + def response_listener(error_response): + logging.user(user, "~FRAPNS client get error-response: " + str(error_response)) + + apns.gateway_server.register_response_listener(response_listener) + for token in tokens.ios_tokens: logging.user(user, '~BMStory notification by iOS: ~FY~SB%s~SN~BM~FY/~SB%s' % (story['story_title'][:50], usersub.feed.feed_title[:50]))