fix(database): fix filter regression from clean-up (#599)

* fix(database): fix filter regression from clean-up

* rollback transaction commits

* fix(database): revert action count query
This commit is contained in:
Kyle Sanderson 2022-12-31 03:27:42 -08:00 committed by GitHub
parent 6b1490726f
commit 5da28a0918
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 19 deletions

View file

@ -28,7 +28,6 @@ func NewActionRepo(log logger.Logger, db *DB, clientRepo domain.DownloadClientRe
}
func (r *ActionRepo) FindByFilterID(ctx context.Context, filterID int) ([]*domain.Action, error) {
tx, err := r.db.BeginTx(ctx, &sql.TxOptions{Isolation: sql.LevelReadCommitted})
if err != nil {
return nil, err
@ -51,10 +50,6 @@ func (r *ActionRepo) FindByFilterID(ctx context.Context, filterID int) ([]*domai
}
}
if err = tx.Commit(); err != nil {
return nil, errors.Wrap(err, "error finding filter by id")
}
return actions, nil
}
@ -611,8 +606,7 @@ func (r *ActionRepo) StoreFilterActions(ctx context.Context, actions []*domain.A
r.log.Debug().Msgf("action.StoreFilterActions: store '%v' type: '%v' on filter: %v", action.Name, action.Type, filterID)
}
err = tx.Commit()
if err != nil {
if err := tx.Commit(); err != nil {
return nil, errors.Wrap(err, "error updating filter actions")
}