Skip to content

Commit

Permalink
use high timeout for api call to prevent etherpad crash
Browse files Browse the repository at this point in the history
  • Loading branch information
0x46616c6b committed Mar 29, 2021
1 parent 74434e7 commit a7ff7e1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"net/http"
"os"
"text/template"
"time"

log "github.com/sirupsen/logrus"
)
Expand Down Expand Up @@ -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")
}
Expand Down

0 comments on commit a7ff7e1

Please sign in to comment.