remove record rule check (#1090)
Co-authored-by: ziv <xiaozheng@tuya.com>
This commit is contained in:
parent
58e777eb00
commit
ea46401db2
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue