1
0
mirror of https://github.com/mxpv/podsync.git synced 2024-05-11 05:55:04 +00:00

Fix self update loop

This commit is contained in:
Maksym Pavlenko
2020-04-19 14:26:53 -07:00
parent 57d84f71bc
commit df7dc56daf

View File

@ -59,13 +59,15 @@ func New(ctx context.Context, update bool) (*YoutubeDl, error) {
}
if update {
// Do initial update at launch
// Do initial blocking update at launch
if err := ytdl.Update(ctx); err != nil {
log.WithError(err).Error("failed to update youtube-dl")
}
go func() {
for range time.After(UpdatePeriod) {
for {
time.Sleep(UpdatePeriod)
if err := ytdl.Update(context.Background()); err != nil {
log.WithError(err).Error("update failed")
}