Пример #1
0
//does the actual call, returning the connection and the internal request
func (this *JsonClient) doApiCall(conn *cheshireConn, req *cheshire.Request, responseChan chan *cheshire.Response, errorChan chan error) (*cheshireRequest, error) {
	if conn == nil {
		return nil, fmt.Errorf("Cannot do api call, conn is nil")
	}
	if req.TxnId() == "" {
		req.SetTxnId(NewTxnId())
	}
	r, err := conn.sendRequest(req, responseChan, errorChan)
	return r, err
}
Пример #2
0
//does the actual call, returning the connection and the internal request
func (this *JsonClient) doApiCall(req *cheshire.Request, responseChan chan *cheshire.Response, errorChan chan error) (*cheshireRequest, error) {
	conn, err := this.connection()
	if err != nil {
		return nil, err
	}
	if req.TxnId() == "" {
		req.SetTxnId(cheshire.NewTxnId())
	}
	r, err := conn.sendRequest(req, responseChan, errorChan)
	if err == nil {
		this.pool.Return(conn)
	} else {
		this.pool.ReturnBroken(conn)
	}
	return r, err
}