From 9e4c9e9d8c85ac8fa76d7a5f054b8c41be5e01d8 Mon Sep 17 00:00:00 2001 From: Kavin <20838718+FireMasterK@users.noreply.github.com> Date: Wed, 26 Jul 2023 21:31:31 +0100 Subject: [PATCH] Set a timeout for requests. --- main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index d9bfe4c..793c5b9 100644 --- a/main.go +++ b/main.go @@ -44,8 +44,12 @@ type FrontendConfig struct { S3Enabled bool `json:"s3Enabled"` } +var client = http.Client{ + Timeout: 10 * time.Second, +} + func testUrl(url string) (*http.Response, error) { - resp, err := http.Get(url) + resp, err := client.Get(url) if err != nil { return resp, err }