Skip to content

Commit

Permalink
Merge pull request #982 from gobitfly/BEDS-101/fix_empty_array_error
Browse files Browse the repository at this point in the history
fix(notification): do not throw error when exporting empty notificati…
  • Loading branch information
peterbitfly authored Oct 18, 2024
2 parents a41039f + f260867 commit f8db000
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions backend/pkg/notification/queuing.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand Down Expand Up @@ -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"`
}
Expand Down

0 comments on commit f8db000

Please sign in to comment.