add a timeout to http client

This commit is contained in:
Drew Weymouth
2023-05-12 20:32:57 -07:00
parent 33f456c94d
commit eab7842424
+2 -2
View File
@@ -71,14 +71,14 @@ func (s *ServerManager) testConnectionAndCreateClient(connection ServerConnectio
func (s *ServerManager) connect(connection ServerConnection, password string) (*subsonic.Client, error) { func (s *ServerManager) connect(connection ServerConnection, password string) (*subsonic.Client, error) {
cli := &subsonic.Client{ cli := &subsonic.Client{
Client: &http.Client{}, Client: &http.Client{Timeout: 10 * time.Second},
BaseUrl: connection.Hostname, BaseUrl: connection.Hostname,
User: connection.Username, User: connection.Username,
PasswordAuth: connection.LegacyAuth, PasswordAuth: connection.LegacyAuth,
ClientName: "supersonic", ClientName: "supersonic",
} }
altCli := &subsonic.Client{ altCli := &subsonic.Client{
Client: &http.Client{}, Client: &http.Client{Timeout: 10 * time.Second},
BaseUrl: connection.AltHostname, BaseUrl: connection.AltHostname,
User: connection.Username, User: connection.Username,
PasswordAuth: connection.LegacyAuth, PasswordAuth: connection.LegacyAuth,