autoborrow: use context timeout handling

This commit is contained in:
c9s 2023-07-12 15:07:51 +08:00
parent 7781d5c70f
commit d6ade1f2fd
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -225,6 +225,12 @@ func (s *Strategy) checkAndBorrow(ctx context.Context) {
s.tryToRepayAnyDebt(ctx)
select {
case <-ctx.Done():
return
case <-time.After(time.Second * 5):
}
// update account info after the repay
account, err = s.ExchangeSession.UpdateAccount(ctx)
if err != nil {