From d4d35482abda31fb537590d154c1c07bc0f698c5 Mon Sep 17 00:00:00 2001 From: Jordan Hotmann Date: Mon, 27 Nov 2023 17:47:07 -0700 Subject: [PATCH] Add timeout --- pkg/qbittorrent/api.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/qbittorrent/api.go b/pkg/qbittorrent/api.go index 961aa2c..40a55b9 100644 --- a/pkg/qbittorrent/api.go +++ b/pkg/qbittorrent/api.go @@ -5,6 +5,7 @@ import ( "net/http" "os" "strings" + "time" "code.jhot.me/jhot/hats/internal/util" "github.com/go-resty/resty/v2" @@ -16,7 +17,7 @@ type QbittorrentClient struct { func New(host string) *QbittorrentClient { return &QbittorrentClient{ - restClient: resty.New().SetBaseURL(fmt.Sprintf("%s/api/v2", host)), + restClient: resty.New().SetTimeout(30 * time.Second).SetBaseURL(fmt.Sprintf("%s/api/v2", host)), } }