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.
This commit is contained in:
Matt Joiner 2023-04-04 19:13:14 +10:00
parent 42d29d95a6
commit fdb0911e28
No known key found for this signature in database
GPG Key ID: 6B990B8185E7F782
1 changed files with 2 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package torrent
import ( import (
"context" "context"
"errors"
"fmt" "fmt"
"net/http" "net/http"
@ -34,7 +35,7 @@ func (t *Torrent) UseSources(sources []string) {
panic(s) panic(s)
} }
level := log.Debug level := log.Debug
if err != nil { if err != nil && !errors.Is(err, context.Canceled) {
level = log.Warning level = log.Warning
} }
t.logger.Levelf(level, "used torrent source %q [err=%v]", s, err) t.logger.Levelf(level, "used torrent source %q [err=%v]", s, err)