3
0

Remove enabled setting on record deduplication

This commit is contained in:
Peter Grlica 2023-12-22 12:13:23 +01:00
parent 85ae51bf20
commit cbdad33e1c
No known key found for this signature in database
3 changed files with 4 additions and 8 deletions

View File

@ -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,

View File

@ -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:"-"`

View File

@ -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
})