From f2608670b61f9f495860d9152f23d3e29713b547 Mon Sep 17 00:00:00 2001 From: peter <1674920+peterbitfly@users.noreply.github.com> Date: Fri, 18 Oct 2024 07:35:43 +0000 Subject: [PATCH] fix(notification): do not throw error when exporting empty notification list --- backend/pkg/notification/queuing.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/pkg/notification/queuing.go b/backend/pkg/notification/queuing.go index bd46e2875..90cb78bca 100644 --- a/backend/pkg/notification/queuing.go +++ b/backend/pkg/notification/queuing.go @@ -421,6 +421,9 @@ func QueueEmailNotifications(epoch uint64, notificationsByUserID types.Notificat // now batch insert the emails in one go log.Infof("queueing %v email notifications", len(emails)) + if len(emails) == 0 { + return nil + } type insertData struct { Content types.TransitEmailContent `db:"content"` } @@ -558,6 +561,9 @@ func QueuePushNotification(epoch uint64, notificationsByUserID types.Notificatio // now batch insert the push messages in one go log.Infof("queueing %v push notifications", len(pushMessages)) + if len(pushMessages) == 0 { + return nil + } type insertData struct { Content types.TransitPushContent `db:"content"` }