mirror of
https://github.com/idanoo/autobrr
synced 2025-07-22 16:29:12 +00:00
feat(feed): Configurable request timeout (#456)
* feat(feed): Add field for setting request timeout * fix: missing type in interface * feat: add postgres migration and column to base schema
This commit is contained in:
parent
47eaeaa635
commit
72be86a34f
10 changed files with 42 additions and 14 deletions
|
@ -35,6 +35,7 @@ type feedInstance struct {
|
|||
ApiKey string
|
||||
Implementation string
|
||||
CronSchedule time.Duration
|
||||
Timeout time.Duration
|
||||
}
|
||||
|
||||
type service struct {
|
||||
|
@ -300,6 +301,7 @@ func (s *service) startJob(f domain.Feed) error {
|
|||
URL: f.URL,
|
||||
ApiKey: f.ApiKey,
|
||||
CronSchedule: time.Duration(f.Interval) * time.Minute,
|
||||
Timeout: time.Duration(f.Timeout) * time.Second,
|
||||
}
|
||||
|
||||
switch fi.Implementation {
|
||||
|
@ -330,7 +332,7 @@ func (s *service) addTorznabJob(f feedInstance) error {
|
|||
l := s.log.With().Str("feed", f.Name).Logger()
|
||||
|
||||
// setup torznab Client
|
||||
c := torznab.NewClient(torznab.Config{Host: f.URL, ApiKey: f.ApiKey})
|
||||
c := torznab.NewClient(torznab.Config{Host: f.URL, ApiKey: f.ApiKey, Timeout: f.Timeout})
|
||||
|
||||
// create job
|
||||
job := NewTorznabJob(f.Name, f.IndexerIdentifier, l, f.URL, c, s.cacheRepo, s.releaseSvc)
|
||||
|
@ -373,7 +375,7 @@ func (s *service) addRSSJob(f feedInstance) error {
|
|||
l := s.log.With().Str("feed", f.Name).Logger()
|
||||
|
||||
// create job
|
||||
job := NewRSSJob(f.Name, f.IndexerIdentifier, l, f.URL, s.cacheRepo, s.releaseSvc)
|
||||
job := NewRSSJob(f.Name, f.IndexerIdentifier, l, f.URL, s.cacheRepo, s.releaseSvc, f.Timeout)
|
||||
|
||||
// schedule job
|
||||
id, err := s.scheduler.AddJob(job, f.CronSchedule, f.IndexerIdentifier)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue