Skip to content

Bulk hits waiting in pool  #4

@vanipolnedi

Description

@vanipolnedi

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()
}

`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions