feat(actions): simplify macro parsing (#560)

* refactor(action): parse macros

* feat(action): add ctx to arr clients and test
This commit is contained in:
ze0s 2022-12-10 21:48:19 +01:00 committed by GitHub
parent f6e68fae2b
commit 839eb9f3f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 323 additions and 334 deletions

View file

@ -9,13 +9,13 @@ import (
"github.com/autobrr/autobrr/pkg/readarr"
)
func (s *service) readarr(action domain.Action, release domain.Release) ([]string, error) {
func (s *service) readarr(ctx context.Context, action *domain.Action, release domain.Release) ([]string, error) {
s.log.Trace().Msg("action READARR")
// TODO validate data
// get client for action
client, err := s.clientSvc.FindByID(context.TODO(), action.ClientID)
client, err := s.clientSvc.FindByID(ctx, action.ClientID)
if err != nil {
return nil, errors.Wrap(err, "readarr could not find client: %v", action.ClientID)
}
@ -51,7 +51,7 @@ func (s *service) readarr(action domain.Action, release domain.Release) ([]strin
PublishDate: time.Now().Format(time.RFC3339),
}
rejections, err := arr.Push(r)
rejections, err := arr.Push(ctx, r)
if err != nil {
return nil, errors.Wrap(err, "readarr: failed to push release: %v", r)
}