From a7ff7e1d15445941d3c670a53cc1536ffdc7aedc Mon Sep 17 00:00:00 2001 From: Falk Scheerschmidt Date: Mon, 29 Mar 2021 16:25:47 +0200 Subject: [PATCH] use high timeout for api call to prevent etherpad crash --- main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 73de9fd..a55b2e0 100644 --- a/main.go +++ b/main.go @@ -7,6 +7,7 @@ import ( "net/http" "os" "text/template" + "time" log "github.com/sirupsen/logrus" ) @@ -174,7 +175,8 @@ func (h handler) ServeHTTP(w http.ResponseWriter, req *http.Request) { } if h.etherpadAPIToken != "" { - res, err := http.Get(h.etherpadURL + fmt.Sprintf("/api/1.2.14/getStats?apikey=%s", h.etherpadAPIToken)) + client := http.Client{Timeout: time.Second * 120} + res, err := client.Get(h.etherpadURL + fmt.Sprintf("/api/1.2.14/getStats?apikey=%s", h.etherpadAPIToken)) if err != nil { log.WithError(err).Error("error while fetching /getStats from etherpad api") }