Some minor refactoring.

- Updated notifications_dao.update_notification_status_by_id with an optional parameter to set the sent_by, this will eliminate a separate update to notifcaitons.
- Added the callback url to the log message, that way we can see if it's the same url failing.
- Stop sending the status callbacks for PENDING status.
This commit is contained in:
Rebecca Law
2018-10-24 11:24:53 +01:00
parent 08caaec0f8
commit 00f04c33c8
5 changed files with 33 additions and 14 deletions

View File

@@ -143,7 +143,7 @@ def _update_notification_status(notification, status):
@statsd(namespace="dao")
@transactional
def update_notification_status_by_id(notification_id, status):
def update_notification_status_by_id(notification_id, status, sent_by=None):
notification = Notification.query.with_lockmode("update").filter(
Notification.id == notification_id,
or_(
@@ -158,7 +158,8 @@ def update_notification_status_by_id(notification_id, status):
if notification.international and not country_records_delivery(notification.phone_prefix):
return None
if not notification.sent_by and sent_by:
notification.sent_by = sent_by
return _update_notification_status(
notification=notification,
status=status