func (c *PClient) DoPool(req *http.Request) (*http.Response, error) {
	if c.maxPoolSize > 0 {
		c.cSemaphore <- 1 // Grab a connection from our pool
		defer func() {
			<-c.cSemaphore // Defer release our connection back to the pool
		}()
	}

	if c.reqPerSecond > 0 {
		<-c.rateLimiter // Block until a signal is emitted from the rateLimiter
	}

	// Perform the normal request using the underlying http.Client
	resp, err := c.client.Do(req)
	if err != nil {
		return &http.Response{}, err
	}

	// resp.Body intentionally not closed

	return resp, nil
}
// DoPool does the required synchronization with channels to
// perform the request in accordance to the PClient's maximum pool size
// and requests-per-second rate limiter.
//
// Caller should close resp.Body when done reading from it.
//
// It is an exported function in case a direct call to this method is
// desired
DoPool does the required synchronization with channels to
perform the request in accordance to the PClient's maximum pool size
and requests-per-second rate limiter.

Caller should close resp.Body when done reading from it.

It is an exported function in case a direct call to this method is
desired
// DoPool does the required synchronization with channels to // perform the request in accordance to the PClient ' s maximum pool size // and requests - per - second rate limiter . // // Caller should close resp . Body when done reading from it . // // It is an exported function in case a direct call to this method is // desired
func (c *PClient) DoPool(req *http.Request) (*http.Response, error) {
	if c.maxPoolSize > 0 {
		c.cSemaphore <- 1 
		defer func() {
			<-c.cSemaphore 
		}()
	}
	if c.reqPerSecond > 0 {
		<-c.rateLimiter 
	}
	resp, err := c.client.Do(req)
	if err != nil {
		return &http.Response{}, err
	}
	return resp, nil
}
func ( c * PClient ) DoPool ( req * http . Request ) ( * http . Response , error ) { if c . maxPoolSize > 0 { c . cSemaphore <- 1 defer func ( ) { <- c . cSemaphore } ( ) } if c . reqPerSecond > 0 { <- c . rateLimiter } resp , err := c . client . Do ( req ) if err != nil { return & http . Response { } , err } return resp , nil }
DoPool does the required synchronization with channels to
perform the request in accordance to the PClient's maximum pool size
and requests-per-second rate limiter.
DoPool does the required synchronization with channels to perform the request in accordance to the PClient ' s maximum pool size and requests - per - second rate limiter .
// Grab a connection from our pool // Defer release our connection back to the pool // Block until a signal is emitted from the rateLimiter // Perform the normal request using the underlying http.Client // resp.Body intentionally not closed