Add a cached http client

This commit is contained in:
Deluan
2021-02-07 23:26:05 -05:00
committed by Deluan Quintão
parent 9d24106066
commit 28cdf1e693
11 changed files with 234 additions and 14 deletions
+3 -1
View File
@@ -8,6 +8,7 @@ import (
"strings"
"github.com/navidrome/navidrome/conf"
"github.com/navidrome/navidrome/consts"
"github.com/navidrome/navidrome/core/spotify"
"github.com/navidrome/navidrome/log"
"github.com/navidrome/navidrome/model"
@@ -31,7 +32,8 @@ func spotifyConstructor(ctx context.Context) Interface {
id: conf.Server.Spotify.ID,
secret: conf.Server.Spotify.Secret,
}
l.client = spotify.NewClient(l.id, l.secret, http.DefaultClient)
hc := NewCachedHTTPClient(http.DefaultClient, consts.DefaultCachedHttpClientTTL)
l.client = spotify.NewClient(l.id, l.secret, hc)
return l
}