Skip to content

Commit

Permalink
Update Go to v1.23
Browse files Browse the repository at this point in the history
  • Loading branch information
AndeyM committed Jan 19, 2025
1 parent 1dd7d42 commit 7ff75c1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/
9 changes: 6 additions & 3 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"time"
)

const defaultBatchSize = 20
Expand Down Expand Up @@ -96,12 +96,15 @@ func (c *Client) send(metric []Metric) error {
req.SetBasicAuth(c.authUser, c.authPass)
}
req.Header.Add("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
httpClient := http.Client{
Timeout: 5 * time.Second,
}
res, err := httpClient.Do(req)
if err != nil {
return err
}
if res.StatusCode >= 400 {
b, err := ioutil.ReadAll(res.Body)
b, err := io.ReadAll(res.Body)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/n10ty/opentsdb-go-push

go 1.18
go 1.23

0 comments on commit 7ff75c1

Please sign in to comment.