remove record rule check (#1090)

Co-authored-by: ziv <xiaozheng@tuya.com>
This commit is contained in:
xiaoziv 2022-08-06 18:15:04 +08:00 committed by GitHub
parent 58e777eb00
commit ea46401db2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 17 deletions

View File

@ -83,14 +83,15 @@ func (re *RecordingRule) Add() error {
return err return err
} }
exists, err := RecordingRuleExists(0, re.GroupId, re.Cluster, re.Name) // 由于实际场景中会出现name重复的recording rule所以不需要检查重复
if err != nil { //exists, err := RecordingRuleExists(0, re.GroupId, re.Cluster, re.Name)
return err //if err != nil {
} // return err
//}
if exists { //
return errors.New("RecordingRule already exists") //if exists {
} // return errors.New("RecordingRule already exists")
//}
now := time.Now().Unix() now := time.Now().Unix()
re.CreateAt = now re.CreateAt = now
@ -100,15 +101,16 @@ func (re *RecordingRule) Add() error {
} }
func (re *RecordingRule) Update(ref RecordingRule) error { func (re *RecordingRule) Update(ref RecordingRule) error {
if re.Name != ref.Name { // 由于实际场景中会出现name重复的recording rule所以不需要检查重复
exists, err := RecordingRuleExists(re.Id, re.GroupId, re.Cluster, ref.Name) //if re.Name != ref.Name {
if err != nil { // exists, err := RecordingRuleExists(re.Id, re.GroupId, re.Cluster, ref.Name)
return err // if err != nil {
} // return err
if exists { // }
return errors.New("RecordingRule already exists") // if exists {
} // return errors.New("RecordingRule already exists")
} // }
//}
ref.FE2DB() ref.FE2DB()
ref.Id = re.Id ref.Id = re.Id