mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
fix(feeds): start feeds in background (#1718)
This commit is contained in:
parent
c3824f3519
commit
ac6f62db99
1 changed files with 15 additions and 12 deletions
|
@ -375,20 +375,23 @@ func (s *service) start() error {
|
||||||
|
|
||||||
s.log.Debug().Msgf("preparing staggered start of %d feeds", len(feeds))
|
s.log.Debug().Msgf("preparing staggered start of %d feeds", len(feeds))
|
||||||
|
|
||||||
for _, feed := range feeds {
|
// start in background to not block startup and signal.Notify signals until all feeds are started
|
||||||
if !feed.Enabled {
|
go func(feeds []domain.Feed) {
|
||||||
s.log.Trace().Msgf("feed disabled, skipping... %s", feed.Name)
|
for _, feed := range feeds {
|
||||||
continue
|
if !feed.Enabled {
|
||||||
}
|
s.log.Trace().Msgf("feed disabled, skipping... %s", feed.Name)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if err := s.startJob(&feed); err != nil {
|
if err := s.startJob(&feed); err != nil {
|
||||||
s.log.Error().Err(err).Msgf("failed to initialize feed job: %s", feed.Name)
|
s.log.Error().Err(err).Msgf("failed to initialize feed job: %s", feed.Name)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// add sleep for the next iteration to start staggered which should mitigate sqlite BUSY errors
|
// add sleep for the next iteration to start staggered which should mitigate sqlite BUSY errors
|
||||||
time.Sleep(time.Second * 5)
|
time.Sleep(time.Second * 5)
|
||||||
}
|
}
|
||||||
|
}(feeds)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue