mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-23 23:16:49 +00:00
cmd/wrapper_coverage: prevent non-needed REST requests via context timeout (#1154)
* wrapper_coverage/exchanges: cancel context to not send rest requests/ populate context through functions that do rest requests * linter: fix * exchange_template: fix test --------- Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
This commit is contained in:
@@ -109,8 +109,11 @@ func testWrappers(e exchange.IBotExchange) ([]string, error) {
|
||||
|
||||
if input.Implements(contextParam) {
|
||||
// Need to deploy a context.Context value as nil value is not
|
||||
// checked throughout codebase.
|
||||
inputs[y] = reflect.ValueOf(context.Background())
|
||||
// checked throughout codebase. Cancelled to minimise external
|
||||
// calls and speed up operation.
|
||||
cancelled, cancelfn := context.WithTimeout(context.Background(), 0)
|
||||
cancelfn()
|
||||
inputs[y] = reflect.ValueOf(cancelled)
|
||||
continue
|
||||
}
|
||||
inputs[y] = reflect.Zero(input)
|
||||
|
||||
Reference in New Issue
Block a user