Update request.go to fix concurrency nonce issues (#285)

* Updates nonce generation to adhere to fifo channel buffer before request executes by routine

* removed unused variables, lns etc

* Fix requested changes and added in timer that disengages lock if out of scope error occurs

* Fixed woopsy daisy issue

* Add benchmark, reduce time in force to unlock before stack insertion, add nil check for edge case

* Remove unusued waitgroup field

* use return nonce.Value and method, rm redundant nonce code, fix tests.

* Fix linter issue: unnecessary conversion
This commit is contained in:
Ryan O'Hara-Reid
2019-05-06 13:46:34 +10:00
committed by Adrian Gallagher
parent 1967507d40
commit 35b94268e0
46 changed files with 312 additions and 258 deletions

View File

@@ -361,7 +361,7 @@ func (z *ZB) GetCryptoAddress(currency currency.Code) (UserAddress, error) {
// SendHTTPRequest sends an unauthenticated HTTP request
func (z *ZB) SendHTTPRequest(path string, result interface{}) error {
return z.SendPayload(http.MethodGet, path, nil, nil, result, false, z.Verbose)
return z.SendPayload(http.MethodGet, path, nil, nil, result, false, false, z.Verbose)
}
// SendAuthenticatedHTTPRequest sends authenticated requests to the zb API
@@ -397,6 +397,7 @@ func (z *ZB) SendAuthenticatedHTTPRequest(httpMethod string, params url.Values,
strings.NewReader(""),
&intermediary,
true,
false,
z.Verbose)
if err != nil {
return err

View File

@@ -346,7 +346,7 @@ func (z *ZB) GetActiveOrders(getOrdersRequest *exchange.GetOrdersRequest) ([]exc
Amount: order.TotalAmount,
Exchange: z.Name,
OrderDate: orderDate,
Price: float64(order.Price),
Price: order.Price,
OrderSide: orderSide,
CurrencyPair: symbol,
})
@@ -403,7 +403,7 @@ func (z *ZB) GetOrderHistory(getOrdersRequest *exchange.GetOrdersRequest) ([]exc
Amount: order.TotalAmount,
Exchange: z.Name,
OrderDate: orderDate,
Price: float64(order.Price),
Price: order.Price,
OrderSide: orderSide,
CurrencyPair: symbol,
})