revert of time.Until which fails on 1.5,1.6, & 1.7

This commit is contained in:
Daniel Melton 2019-06-17 07:39:03 -04:00
parent 2c6b470ed7
commit cc05027dd1

View File

@ -129,7 +129,7 @@ func (c *Client) SendWithAuth(req *http.Request, v interface{}) error {
// to happen outside of the locked section. // to happen outside of the locked section.
if c.Token != nil { if c.Token != nil {
if !c.tokenExpiresAt.IsZero() && time.Until(c.tokenExpiresAt) < RequestNewTokenBeforeExpiresIn { if !c.tokenExpiresAt.IsZero() && c.tokenExpiresAt.Sub(time.Now()) < RequestNewTokenBeforeExpiresIn {
// c.Token will be updated in GetAccessToken call // c.Token will be updated in GetAccessToken call
if _, err := c.GetAccessToken(); err != nil { if _, err := c.GetAccessToken(); err != nil {
c.Unlock() c.Unlock()