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 authored and SongZhen0704 committed Oct 22, 2024
1 parent 7e8555e commit 7cc1b5b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions 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 @@ -301,10 +305,9 @@ func (a *AgentGroupConfig) DeleteAgentGroupConfig(groupLcuuid string) error {
return err
}

var agentGroup model.VTapGroup
if err := dbInfo.Where("lcuuid = ?", groupLcuuid).First(&agentGroup).Error; err != nil {
if err := dbInfo.Where("agent_group_lcuuid = ?", groupLcuuid).Delete(&agentconf.MySQLAgentGroupConfiguration{}).Error; err != nil {
return err
}

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

0 comments on commit 7cc1b5b

Please sign in to comment.