diff --git a/autopush/db.py b/autopush/db.py index 7f0b597f..bdef0ea5 100644 --- a/autopush/db.py +++ b/autopush/db.py @@ -436,7 +436,7 @@ def save_channels(self, uaid, channels): @track_provisioned def store_message(self, notification): - # type: (WebPushNotification) -> bool + # type: (WebPushNotification) -> None """Stores a WebPushNotification in the message table""" item = dict( uaid=hasher(notification.uaid.hex), @@ -448,7 +448,6 @@ def store_message(self, notification): updateid=notification.update_id ) self.table.put_item(data=item, overwrite=True) - return True @track_provisioned def delete_message(self, notification): diff --git a/autopush/router/webpush.py b/autopush/router/webpush.py index fd3f8fb0..177c9a08 100644 --- a/autopush/router/webpush.py +++ b/autopush/router/webpush.py @@ -100,16 +100,14 @@ def route_notification(self, notification, uaid_data): # - Success (older version): Done, return 202 # - Error (db error): Done, return 503 try: - result = yield self._save_notification(uaid_data, notification) - if result is False: - returnValue(self.stored_response(notification)) + yield self._save_notification(uaid_data, notification) except JSONResponseError: raise RouterException("Error saving to database", status_code=503, response_body="Retry Request", errno=201) - # - Lookup client + # - Lookup client again to get latest node state after save. # - Success (node found): Notify node of new notification # - Success: Done, return 200 # - Error (no client): Done, return 202 @@ -119,7 +117,6 @@ def route_notification(self, notification, uaid_data): # - Error (db error): Done, return 202 # - Error (no client) : Done, return 404 try: - # is this call redundant? We already get uaid_data passed in uaid_data = yield deferToThread(router.get_uaid, uaid) except JSONResponseError: returnValue(self.stored_response(notification))