Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bulk hits waiting in pool #4

Open
vanipolnedi opened this issue Jan 28, 2020 · 0 comments
Open

Bulk hits waiting in pool #4

vanipolnedi opened this issue Jan 28, 2020 · 0 comments

Comments

@vanipolnedi
Copy link

Hi,
when i test code with bulk messages (nearly 1lakh), all messages are waiting in pool and getting responses after sometime but i want to get responses concurrently

Note: for single message, i'm getting response immediately

Sample Code:
` package main
import (
"net/http"
"bytes"
"strconv"
"encoding/json"
"github.com/ewohltman/pool"
)

var HTTPClient = &http.Client{}
var PoolClient = pool.NewPClient(HTTPClient,200,250)

func main() {
	src:="123"
	dest:=1234567890
	msg:="dsjfhdkfhjd0"
	bst:="http://test/callbackurl"
	jsonStr := []byte(`{
		"test1": {
		  "src": "`+src+`",
		  "dest": `+strconv.Itoa(dest)+`,
		  "msg": "`+msg+`",
		  "url": "`+bst+`"
		}
		"test2": {
		  "id": 82109
		}
		}
		`)
	apiUrl := "https://test/message"
		
	jsonStr1,err:=	json.Marshal(jsonStr)
	req, err := http.NewRequest("POST", apiUrl, bytes.NewBuffer(jsonStr1)) 
	if err!=nil{
		panic(err)
	}

	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("requestid", "82109")
	req.Header.Set("Authorization", "Bearer Mi84T0FBQUF5S1VHY2YvczU2MnNYTFYxV0RtVDVybjFHRGhqNXc1ZWo1QlpwRmRmUzhZPSIsImFtciI6WyJwd2QiXSwiYXBwaWQiOiIxZjIyNTdmZS1iM2I5LTRkNjctOTNmMi1kYzYzNjdkNjBjODAiLCJhcHBpZGFjciI6IjAiLCJpcGFkZHIiOiI0MC44MS43")

	resp, err := PoolClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()
}

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant