Skip to content

Commit

Permalink
feature: calls trisolaris refresh after updating agent group config
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhengYa-0110 committed Oct 22, 2024
1 parent 7e8555e commit a930a64
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion server/controller/http/service/agent_group_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ import (
"gorm.io/gorm"

agentconf "github.com/deepflowio/deepflow/server/agent_config"
"github.com/deepflowio/deepflow/server/controller/common"
"github.com/deepflowio/deepflow/server/controller/config"
"github.com/deepflowio/deepflow/server/controller/db/mysql"
"github.com/deepflowio/deepflow/server/controller/db/mysql/model"
httpcommon "github.com/deepflowio/deepflow/server/controller/http/common"
"github.com/deepflowio/deepflow/server/controller/trisolaris/refresh"
)

var (
Expand Down Expand Up @@ -260,6 +262,7 @@ func (a *AgentGroupConfig) CreateAgentGroupConfig(groupLcuuid string, data map[s
if err := dbInfo.Save(&agentGroupConfig).Error; err != nil {
return nil, err
}
refresh.RefreshCache(dbInfo.GetORGID(), []common.DataChanged{common.DATA_CHANGED_VTAP})
return a.GetAgentGroupConfig(groupLcuuid, dataType)
}

Expand Down Expand Up @@ -292,6 +295,7 @@ func (a *AgentGroupConfig) UpdateAgentGroupConfig(groupLcuuid string, data map[s
if err := dbInfo.Save(&agentGroupConfig).Error; err != nil {
return nil, err
}
refresh.RefreshCache(dbInfo.GetORGID(), []common.DataChanged{common.DATA_CHANGED_VTAP})
return a.GetAgentGroupConfig(groupLcuuid, dataType)
}

Expand All @@ -305,6 +309,6 @@ func (a *AgentGroupConfig) DeleteAgentGroupConfig(groupLcuuid string) error {
if err := dbInfo.Where("lcuuid = ?", groupLcuuid).First(&agentGroup).Error; err != nil {
return err
}

refresh.RefreshCache(dbInfo.GetORGID(), []common.DataChanged{common.DATA_CHANGED_VTAP})
return dbInfo.Where("agent_group_lcuuid = ?", groupLcuuid).Delete(&agentconf.MySQLAgentGroupConfiguration{}).Error
}

0 comments on commit a930a64

Please sign in to comment.