Skip to content

Commit

Permalink
refactor: get account id from system struct
Browse files Browse the repository at this point in the history
  • Loading branch information
psegedy committed Nov 12, 2024
1 parent e4e398d commit 9b24d4c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion evaluator/evaluate.go
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ func evaluateAndStore(system *models.SystemPlatform,

// Send instant notification with new advisories
if enableInstantNotifications {
err = publishNewAdvisoriesNotification(tx, system, event, system.RhAccountID, systemAdvisoriesNew)
err = publishNewAdvisoriesNotification(tx, system, event, systemAdvisoriesNew)
if err != nil {
evaluationCnt.WithLabelValues("error-advisory-notification").Inc()
utils.LogError("orgID", event.GetOrgID(), "inventoryID", system.GetInventoryID(), "err", err.Error(),
Expand Down
6 changes: 3 additions & 3 deletions evaluator/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ func getSystemTags(tx *gorm.DB, system *models.SystemPlatform) ([]ntf.SystemTag,
}

func publishNewAdvisoriesNotification(tx *gorm.DB, system *models.SystemPlatform, event *mqueue.PlatformEvent,
accountID int, newAdvisories SystemAdvisoryMap) error {
newAdvisories SystemAdvisoryMap) error {
if notificationsPublisher == nil {
return nil
}

advisories, err := getUnnotifiedAdvisories(tx, accountID, newAdvisories)
advisories, err := getUnnotifiedAdvisories(tx, system.RhAccountID, newAdvisories)
if err != nil {
return errors.Wrap(err, "getting unnotified advisories failed")
}
Expand Down Expand Up @@ -136,7 +136,7 @@ func publishNewAdvisoriesNotification(tx *gorm.DB, system *models.SystemPlatform
"notification sent successfully")

err = tx.Table("advisory_account_data").
Where("rh_account_id = ? AND advisory_id IN (?)", accountID, advisoryIDs).
Where("rh_account_id = ? AND advisory_id IN (?)", system.RhAccountID, advisoryIDs).
Update("notified", time.Now()).Error
if err != nil {
return errors.Wrap(err, "updating notified column failed")
Expand Down

0 comments on commit 9b24d4c

Please sign in to comment.