Dont always fall through on every error.

This commit is contained in:
Mark Beamer Jr 2020-07-30 13:37:44 -04:00 committed by Alex Grintsvayg
parent 4d56339756
commit c7c220ecd3
No known key found for this signature in database
GPG key ID: AEB3F089F86A22B5

View file

@ -305,15 +305,15 @@ func run(use string, args []string, withStdErr, withStdOut bool, stopChan stop.C
if strings.Contains(err.Error(), "exit status 1") { if strings.Contains(err.Error(), "exit status 1") {
if strings.Contains(string(errorLog), "HTTP Error 429") || strings.Contains(string(errorLog), "returned non-zero exit status 8") { if strings.Contains(string(errorLog), "HTTP Error 429") || strings.Contains(string(errorLog), "returned non-zero exit status 8") {
pool.SetThrottled(sourceAddress) pool.SetThrottled(sourceAddress)
logrus.Debugf("known throttling error...try again (%d)", attemps)
continue
} }
if attemps > maxtries { if attemps > maxtries {
logrus.Debug("too many tries returning failure") logrus.Debug("too many tries returning failure")
break break
} }
logrus.Debugf("known throttling error...try again (%d)", attemps)
continue
} }
logrus.Debug("Unkown error, returning failure") logrus.Debug("Unkown error, returning failure: %s", err.Error())
return nil, errors.Prefix("youtube-dl "+strings.Join(argsForCommand, " "), err) return nil, errors.Prefix("youtube-dl "+strings.Join(argsForCommand, " "), err)
} }
return strings.Split(strings.Replace(string(outLog), "\r\n", "\n", -1), "\n"), nil return strings.Split(strings.Replace(string(outLog), "\r\n", "\n", -1), "\n"), nil