Skip to content

Commit

Permalink
nsq_to_http: fix issue nsqio#998, use values that passed by http_clie…
Browse files Browse the repository at this point in the history
…nt_connect_timeout, http-client-request-timeout flags
  • Loading branch information
kamyanskiy committed Feb 22, 2018
1 parent 2305c6f commit a9e1a5b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 1 addition & 2 deletions apps/nsq_to_http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ import (
"fmt"
"net/http"

"github.com/nsqio/nsq/internal/http_api"
"github.com/nsqio/nsq/internal/version"
)

var httpclient *http.Client
var userAgent string

func init() {
httpclient = &http.Client{Transport: http_api.NewDeadlineTransport(*httpConnectTimeout, *httpRequestTimeout), Timeout: *httpRequestTimeout}

userAgent = fmt.Sprintf("nsq_to_http v%s", version.Binary)
}

Expand Down
4 changes: 4 additions & 0 deletions apps/nsq_to_http/nsq_to_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"io/ioutil"
"log"
"math/rand"
"net/http"
"net/url"
"os"
"os/signal"
Expand All @@ -23,6 +24,7 @@ import (
"github.com/bitly/timer_metrics"
"github.com/nsqio/go-nsq"
"github.com/nsqio/nsq/internal/app"
"github.com/nsqio/nsq/internal/http_api"
"github.com/nsqio/nsq/internal/version"
)

Expand Down Expand Up @@ -171,6 +173,8 @@ func main() {
flag.Var(&nsq.ConfigFlag{cfg}, "consumer-opt", "option to passthrough to nsq.Consumer (may be given multiple times, http://godoc.org/github.com/nsqio/go-nsq#Config)")
flag.Parse()

httpclient = &http.Client{Transport: http_api.NewDeadlineTransport(*httpConnectTimeout, *httpRequestTimeout), Timeout: *httpRequestTimeout}

if *showVersion {
fmt.Printf("nsq_to_http v%s\n", version.Binary)
return
Expand Down

0 comments on commit a9e1a5b

Please sign in to comment.