Merge branch 'master' into fix-memory

This commit is contained in:
yangkaa 2021-07-23 06:10:01 -05:00 committed by GitHub
commit 7d5d77fd4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -2712,7 +2712,15 @@ func (s *ServiceAction) SyncComponentProbes(tx *gorm.DB, components []*api_model
)
for _, component := range components {
componentIDs = append(componentIDs, component.ComponentBase.ComponentID)
probes = append(probes, component.Probe.DbModel(component.ComponentBase.ComponentID))
modes := make(map[string]struct{})
for _, probe := range component.Probes {
_, ok := modes[probe.Mode]
if ok {
continue
}
probes = append(probes, probe.DbModel(component.ComponentBase.ComponentID))
modes[probe.Mode] = struct{}{}
}
}
if err := db.GetManager().ServiceProbeDaoTransactions(tx).DeleteByComponentIDs(componentIDs); err != nil {
return err

View File

@ -243,7 +243,7 @@ type Component struct {
Ports []TenantServicesPort `json:"ports"`
Relations []TenantComponentRelation `json:"relations"`
Envs []ComponentEnv `json:"envs"`
Probe ServiceProbe `json:"probe"`
Probes []ServiceProbe `json:"probes"`
AppConfigGroupRels []AppConfigGroupRelations `json:"app_config_groups"`
Labels []ComponentLabel `json:"labels"`
Plugins []ComponentPlugin `json:"plugins"`