Skip to content

Commit fd107a3

Browse files
committed
fix: don't send notifications for archived dashboards
1 parent 4dd7dac commit fd107a3

File tree

1 file changed

+5
-2
lines changed
  • backend/pkg/notification

1 file changed

+5
-2
lines changed

backend/pkg/notification/db.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
"github.com/lib/pq"
1717
)
1818

19-
// Retrieves all subscription for a given event filter
19+
// Retrieves all active subscriptions for a given event filter
2020
// Map key corresponds to the event filter which can be
2121
// a validator pubkey or an eth1 address (for RPL notifications)
2222
// or a list of validators for the tax report notifications
@@ -144,11 +144,14 @@ func GetSubsForEventFilter(eventName types.EventName, lastSentFilter string, las
144144
FROM users_val_dashboards
145145
LEFT JOIN users_val_dashboards_groups ON users_val_dashboards_groups.dashboard_id = users_val_dashboards.id
146146
LEFT JOIN users_val_dashboards_validators ON users_val_dashboards_validators.dashboard_id = users_val_dashboards_groups.dashboard_id AND users_val_dashboards_validators.group_id = users_val_dashboards_groups.id
147-
WHERE users_val_dashboards_validators.validator_index IS NOT NULL AND users_val_dashboards.id = ANY($1)
147+
WHERE users_val_dashboards_validators.validator_index IS NOT NULL AND users_val_dashboards.id = ANY($1) AND users_val_dashboards.is_archived IS NULL
148148
`, pq.Array(dashboardConfigsToFetch))
149149
if err != nil {
150150
return nil, fmt.Errorf("error getting dashboard definitions: %v", err)
151151
}
152+
if len(dashboardDefinitions) == 0 {
153+
return subMap, nil
154+
}
152155
log.Infof("retrieved %d dashboard definitions", len(dashboardDefinitions))
153156

154157
// Now initialize the validator dashboard configuration map

0 commit comments

Comments
 (0)