Skip to content

Commit df7dc56

Browse files
committed
Fix self update loop
1 parent 57d84f7 commit df7dc56

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pkg/ytdl/ytdl.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,15 @@ func New(ctx context.Context, update bool) (*YoutubeDl, error) {
5959
}
6060

6161
if update {
62-
// Do initial update at launch
62+
// Do initial blocking update at launch
6363
if err := ytdl.Update(ctx); err != nil {
6464
log.WithError(err).Error("failed to update youtube-dl")
6565
}
6666

6767
go func() {
68-
for range time.After(UpdatePeriod) {
68+
for {
69+
time.Sleep(UpdatePeriod)
70+
6971
if err := ytdl.Update(context.Background()); err != nil {
7072
log.WithError(err).Error("update failed")
7173
}

0 commit comments

Comments
 (0)