mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
pkg/exchange: use backoff retry
This commit is contained in:
parent
51718b6eb2
commit
87d763598f
|
@ -11,9 +11,9 @@ import (
|
|||
"golang.org/x/time/rate"
|
||||
|
||||
"github.com/c9s/bbgo/pkg/exchange/bybit/bybitapi"
|
||||
"github.com/c9s/bbgo/pkg/exchange/retry"
|
||||
"github.com/c9s/bbgo/pkg/fixedpoint"
|
||||
"github.com/c9s/bbgo/pkg/types"
|
||||
"github.com/c9s/bbgo/pkg/util"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -351,11 +351,9 @@ func (s *Stream) handleAuthEvent() {
|
|||
|
||||
var balnacesMap types.BalanceMap
|
||||
var err error
|
||||
err = util.Retry(ctx, 10, 300*time.Millisecond, func() error {
|
||||
err = retry.GeneralBackoff(ctx, func() error {
|
||||
balnacesMap, err = s.streamDataProvider.QueryAccountBalances(ctx)
|
||||
return err
|
||||
}, func(err error) {
|
||||
log.WithError(err).Error("failed to call query account balances")
|
||||
})
|
||||
if err != nil {
|
||||
log.WithError(err).Error("no more attempts to retrieve balances")
|
||||
|
|
Loading…
Reference in New Issue
Block a user