use custom http client for slack messages

This commit is contained in:
Niko Storni 2022-09-27 20:21:02 +02:00
parent 69cfd7f798
commit 73228d1bfb

View file

@ -2,7 +2,10 @@ package util
import (
"fmt"
"net"
"net/http"
"strings"
"time"
"github.com/lbryio/lbry.go/v2/extras/errors"
@ -61,6 +64,18 @@ func SendToSlack(format string, a ...interface{}) error {
func sendToSlack(channel, username, message string) error {
var err error
c := &http.Client{
Transport: &http.Transport{
DialContext: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
}).DialContext,
TLSHandshakeTimeout: 10 * time.Second,
ResponseHeaderTimeout: 10 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
},
}
slack.OptionHTTPClient(c)
if slackApi == nil {
err = errors.Err("no slack token provided")
} else {