这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on Feb 8, 2019. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions notification/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@ def send_notifications(notification_id):
notifier.notify(notification)
# Log successful notification
logmessage = EventLog()
logmessage.service_key = notification.incident.service_key
logmessage.incident_key = notification.incident
logmessage.user = notification.user_to_notify
logmessage.action = 'notified'
logmessage.data = "Notification sent to %s about %s service" % (notification.user_to_notify, logmessage.service_key, )
logmessage.occurred_at = timezone.now()
logmessage.save()
if notification.incident:
logmessage.service_key = notification.incident.service_key
logmessage.incident_key = notification.incident
logmessage.user = notification.user_to_notify
logmessage.action = 'notified'
logmessage.data = "Notification sent to %s about %s service" % (notification.user_to_notify, logmessage.service_key, )
logmessage.occurred_at = timezone.now()
logmessage.save()
if notification.notifier != UserNotificationMethod.METHOD_TWILIO_CALL:
# In case of a twilio call, we need the object for TWiml generation
notification.delete()
Expand All @@ -51,12 +52,13 @@ def send_notifications(notification_id):
except:
# Log successful notification
logmessage = EventLog()
logmessage.service_key = notification.incident.service_key
logmessage.incident_key = notification.incident
logmessage.user = notification.user_to_notify
logmessage.action = 'notification_failed'
logmessage.data = "Sending notification failed to %s about %s service" % (notification.user_to_notify, logmessage.service_key, )
logmessage.occurred_at = timezone.now()
logmessage.save()
if notification.incident:
logmessage.service_key = notification.incident.service_key
logmessage.incident_key = notification.incident
logmessage.user = notification.user_to_notify
logmessage.action = 'notification_failed'
logmessage.data = "Sending notification failed to %s about %s service" % (notification.user_to_notify, logmessage.service_key, )
logmessage.occurred_at = timezone.now()
logmessage.save()
raise