From: Matt Joiner Date: Tue, 4 Apr 2023 09:13:14 +0000 (+1000) Subject: Don't log using torrent source as warning for context cancellation X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=fdb0911e28c68fcb703c00d6b21230894baf1193;p=btrtrc.git Don't log using torrent source as warning for context cancellation This probably occurs because the info was obtained and we don't need to try the source anymore. --- diff --git a/sources.go b/sources.go index 3923e8e6..ed5ecbfa 100644 --- a/sources.go +++ b/sources.go @@ -2,6 +2,7 @@ package torrent import ( "context" + "errors" "fmt" "net/http" @@ -34,7 +35,7 @@ func (t *Torrent) UseSources(sources []string) { panic(s) } level := log.Debug - if err != nil { + if err != nil && !errors.Is(err, context.Canceled) { level = log.Warning } t.logger.Levelf(level, "used torrent source %q [err=%v]", s, err)