events: fix error when notification transport doesn't exist anymore

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-10-27 15:38:41 +02:00
parent f2f12ef0ba
commit 0273ae16df
1 changed files with 3 additions and 1 deletions

View File

@ -98,7 +98,9 @@ def notification_transport(self: MonitoredTask, notification_pk: int, transport_
notification: Notification = Notification.objects.filter(pk=notification_pk).first() notification: Notification = Notification.objects.filter(pk=notification_pk).first()
if not notification: if not notification:
return return
transport: NotificationTransport = NotificationTransport.objects.get(pk=transport_pk) transport = NotificationTransport.objects.filter(pk=transport_pk).first()
if not transport:
return
transport.send(notification) transport.send(notification)
self.set_status(TaskResult(TaskResultStatus.SUCCESSFUL)) self.set_status(TaskResult(TaskResultStatus.SUCCESSFUL))
except NotificationTransportError as exc: except NotificationTransportError as exc: