mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #16114 from gouqi11/notifyFix
fix(notify):fixInitSubscriberData
This commit is contained in:
@@ -642,6 +642,14 @@ func (sm *SSubscriberManager) QueryDistinctExtraField(q *sqlchemy.SQuery, field
|
||||
return q, nil
|
||||
}
|
||||
|
||||
var defaultNotifyTopics = []string{
|
||||
DefaultServerPanicked,
|
||||
DefaultServiceAbnormal,
|
||||
DefaultNetOutOfSync,
|
||||
DefaultMysqlOutOfSync,
|
||||
DefaultActionLogExceedCount,
|
||||
}
|
||||
|
||||
func (sm *SSubscriberManager) InitializeData() error {
|
||||
ctx := context.Background()
|
||||
session := auth.GetAdminSession(ctx, options.Options.Region)
|
||||
@@ -655,6 +663,7 @@ func (sm *SSubscriberManager) InitializeData() error {
|
||||
}
|
||||
roleId, _ := role.GetString("id")
|
||||
q := TopicManager.Query()
|
||||
q = q.Filter(sqlchemy.OR(sqlchemy.In(q.Field("name"), defaultNotifyTopics)))
|
||||
topics := []STopic{}
|
||||
err = db.FetchModelObjects(TopicManager, q, &topics)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user