fix(filters): load only from active indexers (#202)

This commit is contained in:
Ludvig Lundgren 2022-03-26 13:57:42 +01:00 committed by GitHub
parent dc0428fcc9
commit 8faf7ed410
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -104,7 +104,7 @@ func (r *FilterRepo) FindByID(ctx context.Context, filterID int) (*domain.Filter
return &f, nil return &f, nil
} }
// FindByIndexerIdentifier find active filters only // FindByIndexerIdentifier find active filters with active indexer only
func (r *FilterRepo) FindByIndexerIdentifier(indexer string) ([]domain.Filter, error) { func (r *FilterRepo) FindByIndexerIdentifier(indexer string) ([]domain.Filter, error) {
//r.db.lock.RLock() //r.db.lock.RLock()
//defer r.db.lock.RUnlock() //defer r.db.lock.RUnlock()
@ -159,6 +159,7 @@ func (r *FilterRepo) FindByIndexerIdentifier(indexer string) ([]domain.Filter, e
JOIN indexer i on i.id = fi.indexer_id JOIN indexer i on i.id = fi.indexer_id
WHERE i.identifier = ? WHERE i.identifier = ?
AND f.enabled = true AND f.enabled = true
AND i.enabled = true
ORDER BY f.priority DESC`, indexer) ORDER BY f.priority DESC`, indexer)
if err != nil { if err != nil {
log.Error().Stack().Err(err).Msg("error querying filter row") log.Error().Stack().Err(err).Msg("error querying filter row")