mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-07 23:16:53 +00:00
exchanges: Initial context propagation (#744)
* gct: phase one context awareness pass * exchanges: context propagation pass * common/requester: force context requirement * gctcli/exchanges: linter fix * rpcserver: fix test using dummy rpc server * backtester: fix comments * grpc: add correct cancel and timeout for commands * rpcserver_test: add comment on dummy server * common: deprecated SendHTTPGetRequest * linter: fix * linter: turn on no context check * apichecker: fix context linter issue * binance: use param context * common: remove checks as this gets executed before main * common: change mutex to RW as clients can be used by multiple go routines. * common: remove init and JIT default client. Unexport global variables and add protection. * common: Add comments * bithumb: after dinner mints fix
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package engine
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
@@ -24,7 +25,7 @@ func SetupWithdrawManager(em iExchangeManager, pm iPortfolioManager, isDryRun bo
|
||||
|
||||
// SubmitWithdrawal performs validation and submits a new withdraw request to
|
||||
// exchange
|
||||
func (m *WithdrawManager) SubmitWithdrawal(req *withdraw.Request) (*withdraw.Response, error) {
|
||||
func (m *WithdrawManager) SubmitWithdrawal(ctx context.Context, req *withdraw.Request) (*withdraw.Response, error) {
|
||||
if m == nil {
|
||||
return nil, ErrNilSubsystem
|
||||
}
|
||||
@@ -60,7 +61,7 @@ func (m *WithdrawManager) SubmitWithdrawal(req *withdraw.Request) (*withdraw.Res
|
||||
}
|
||||
}
|
||||
if req.Type == withdraw.Fiat {
|
||||
ret, err = exch.WithdrawFiatFunds(req)
|
||||
ret, err = exch.WithdrawFiatFunds(ctx, req)
|
||||
if err != nil {
|
||||
resp.Exchange.Status = err.Error()
|
||||
} else {
|
||||
@@ -68,7 +69,7 @@ func (m *WithdrawManager) SubmitWithdrawal(req *withdraw.Request) (*withdraw.Res
|
||||
resp.Exchange.ID = ret.ID
|
||||
}
|
||||
} else if req.Type == withdraw.Crypto {
|
||||
ret, err = exch.WithdrawCryptocurrencyFunds(req)
|
||||
ret, err = exch.WithdrawCryptocurrencyFunds(ctx, req)
|
||||
if err != nil {
|
||||
resp.Exchange.Status = err.Error()
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user