From 6695bce75f33b32256c08908dfedb0e89ea3ebe0 Mon Sep 17 00:00:00 2001 From: Aki Tuomi Date: Sun, 2 Feb 2020 20:40:32 +0200 Subject: [PATCH] push-notification: Don't send event on failure If transaction was rolled back, don't send event. --- .../push-notification/push-notification-plugin.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/plugins/push-notification/push-notification-plugin.c b/src/plugins/push-notification/push-notification-plugin.c index f99ce43c2f..878809dac8 100644 --- a/src/plugins/push-notification/push-notification-plugin.c +++ b/src/plugins/push-notification/push-notification-plugin.c @@ -113,10 +113,13 @@ push_notification_transaction_end(struct push_notification_txn *ptxn, } } - struct event_passthrough *e = event_create_passthrough(ptxn->event)-> - set_name(PUSH_NOTIFICATION_EVENT_FINISHED); - /* Emit event */ - e_debug(e->event(), "Push notification transaction completed"); + if (success) { + struct event_passthrough *e = event_create_passthrough(ptxn->event)-> + set_name(PUSH_NOTIFICATION_EVENT_FINISHED); + /* Emit event */ + e_debug(e->event(), "Push notification transaction completed"); + } + event_unref(&ptxn->event); pool_unref(&ptxn->pool); } -- 2.47.3