Skip to content

Commit

Permalink
timeouts for http;
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuznetsov Dmitrii committed Apr 9, 2020
1 parent f441621 commit 7a54e2d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
13 changes: 12 additions & 1 deletion tankapi/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,28 @@ import (
"fmt"
"io/ioutil"
"log"
"net"
"net/http"
"strings"
"time"
)

const (
createBreakpoint = "init"
prepareBreakpoint = "start"
)

func dialTimeout(network, addr string) (net.Conn, error) {
return net.DialTimeout(network, addr, time.Second*5)
}

var transport = http.Transport{
Dial: dialTimeout,
}

var netClient = &http.Client{
Timeout: time.Second * 10,
Transport: &transport,
Timeout: time.Second * 10,
}

type Session struct {
Expand Down
1 change: 0 additions & 1 deletion tankapi/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)

// Tank - represents tank api server; might have several sessions simultaneously
Expand Down

0 comments on commit 7a54e2d

Please sign in to comment.