fix(feeds): implement staggered start (#1619)

This commit is contained in:
ze0s 2024-08-13 20:46:45 +02:00 committed by GitHub
parent 4b884ee859
commit 59a10a910e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -308,6 +308,13 @@ func (s *service) start() error {
return err
}
if len(feeds) == 0 {
s.log.Debug().Msg("found 0 feeds to start")
return nil
}
s.log.Debug().Msgf("preparing staggered start of %d feeds", len(feeds))
for _, feed := range feeds {
feed := feed
@ -320,6 +327,9 @@ func (s *service) start() error {
s.log.Error().Err(err).Msgf("failed to initialize feed job: %s", feed.Name)
continue
}
// add sleep for the next iteration to start staggered which should mitigate sqlite BUSY errors
time.Sleep(time.Second * 5)
}
return nil