Esempio n. 1
0
// Does a synchronous api call.  times out after the requested timeout.
// This will automatically set the txn accept to single
func (this *JsonClient) ApiCallSync(req *cheshire.Request, timeout time.Duration) (*cheshire.Response, error) {
	conn, err := this.connection()
	//retry if necessary
	for i := 0; i < this.Retries && err != nil; i++ {
		time.Sleep(this.RetryPause)
		conn, err = this.connection()
	}
	if err != nil {
		return nil, err
	}

	req.SetTxnAccept("single")
	response, err := this.doApiCallSync(conn, req, timeout)
	return response, err
}
Esempio n. 2
0
// Does a synchronous api call.  times out after the requested timeout.
// This will automatically set the txn accept to single
func (this *JsonClient) ApiCallSync(req *cheshire.Request, timeout time.Duration) (*cheshire.Response, error) {
	req.SetTxnAccept("single")
	response, err := this.doApiCallSync(req, timeout)
	return response, err
}