From 62dfdc1adb868742356a4534aecbd5d12855adb3 Mon Sep 17 00:00:00 2001 From: Niko Storni Date: Sat, 14 Dec 2019 05:49:25 +0100 Subject: [PATCH] fix possible resource leak --- sources/youtubeVideo.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sources/youtubeVideo.go b/sources/youtubeVideo.go index 7fcdc7d..b386369 100644 --- a/sources/youtubeVideo.go +++ b/sources/youtubeVideo.go @@ -236,8 +236,10 @@ func (v *YoutubeVideo) download(useIPv6 bool) error { time.Sleep(ip_manager.IPCooldownPeriod) sourceAddress, err = v.pool.GetIP() - if err == nil { //TODO: This is possibly not 100% right, but it works so I'm not touching it... + if err == nil { break + } else if !errors.Is(err, ip_manager.ErrAllThrottled) { + return err } } } else {