refresh questrade client if it's nil
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
65d4780a3b
commit
13d3c2e77c
@ -71,7 +71,7 @@ func (p *Provider) Configure() error {
|
||||
// Returns slices of account balances and mapped YNAB account IDs, along with an error
|
||||
func (p *Provider) GetBalances() ([]int, []string, error) {
|
||||
// Refresh credentials if past half way until expiration
|
||||
if p.lastRefresh.Add(time.Second * time.Duration(p.client.Credentials.ExpiresIn) / 2).Before(time.Now()) {
|
||||
if p.lastRefresh.Add(time.Second*time.Duration(p.client.Credentials.ExpiresIn)/2).Before(time.Now()) || p.client == nil {
|
||||
err := p.refresh()
|
||||
if err != nil {
|
||||
return make([]int, 0), make([]string, 0), fmt.Errorf("failed to refresh http client: %v", err)
|
||||
|
Loading…
Reference in New Issue
Block a user