Skip to content

Commit

Permalink
Ensure refresh context doesn't get cancelled
Browse files Browse the repository at this point in the history
The context holding the HTTP client is used to auto
refresh tokens over time. It shouldn't be cancelled.
  • Loading branch information
NeilW committed Nov 7, 2024
1 parent abc2b59 commit f64839e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions brightbox_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,9 @@ func configureClient(ctx context.Context, authd authdetails) (CloudAccess, error
// Authenticate the details and return a client
func authenticatedClient(authCtx context.Context, authd authdetails) (CloudAccess, error) {
klog.V(4).Infof("configureClient")
apiContext, apiCancel := context.WithCancel(context.Background())
defer apiCancel()
apiContext = contextWithLoggedHTTPClient(apiContext)
refreshContext := contextWithLoggedHTTPClient(context.Background())

client, err := brightbox.Connect(apiContext, confFromAuthd(authd))
client, err := brightbox.Connect(refreshContext, confFromAuthd(authd))
if err != nil {
return nil, err
}
Expand Down

0 comments on commit f64839e

Please sign in to comment.