diff --git a/api.go b/api.go index 9559536..3140404 100644 --- a/api.go +++ b/api.go @@ -12,6 +12,7 @@ import ( "strconv" "strings" "sync" + "time" ) type API struct { @@ -77,8 +78,12 @@ func (a *API) getFallbackTrack() (*QueueTrackEntry, error) { original: m, }, nil } + func (a *API) getRandomTrack() (*QueueTrackEntry, error) { - response, err := http.DefaultClient.Get(a.config.Queue.RandomSongApi) + + response, err := (&http.Client{ + Timeout: time.Second * 60, + }).Get(a.config.Queue.RandomSongApi) if err != nil { return nil, err } @@ -91,6 +96,7 @@ func (a *API) getRandomTrack() (*QueueTrackEntry, error) { return a.getQueueEntryFromBody(body) } + func (a *API) setNowRandom(nr *QueueTrackEntry) { a.nr = nr if a.config.Queue.NowRandom != "" {