Remove enabled setting on record deduplication
This commit is contained in:
parent
85ae51bf20
commit
cbdad33e1c
@ -2025,11 +2025,7 @@ func (svc record) DupDetection(ctx context.Context, m *types.Module, rec *types.
|
||||
config = m.Config.RecordDeDup
|
||||
)
|
||||
|
||||
if !config.Enabled {
|
||||
return
|
||||
}
|
||||
|
||||
if len(config.Rules) > 0 {
|
||||
if len(config.Rules) > 0 && config.Rules.Validate() == nil {
|
||||
records, _, err = svc.Find(ctx, types.RecordFilter{
|
||||
ModuleID: m.ID,
|
||||
NamespaceID: m.NamespaceID,
|
||||
|
||||
@ -90,8 +90,6 @@ type (
|
||||
}
|
||||
|
||||
ModuleConfigRecordDeDup struct {
|
||||
Enabled bool `json:"enabled"`
|
||||
|
||||
// strictly restrict record saving
|
||||
// otherwise show a warning with list of duplicated records
|
||||
Strict bool `json:"-"`
|
||||
|
||||
@ -15,12 +15,14 @@ func invalidateDedupRules(ctx context.Context, log *zap.Logger, s store.Storer)
|
||||
return
|
||||
}
|
||||
|
||||
// find only the invalid ones and empty the rules, leave the valid ones
|
||||
// as they were
|
||||
ll, _ = ll.Filter(func(m *types.Module) (bool, error) {
|
||||
return m.Config.RecordDeDup.Rules.Validate() != nil, nil
|
||||
})
|
||||
|
||||
ll.Walk(func(m *types.Module) error {
|
||||
m.Config.RecordDeDup.Enabled = false
|
||||
m.Config.RecordDeDup.Rules = types.DeDupRuleSet{}
|
||||
return nil
|
||||
})
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user