IBM / go-sdk-core

The go-sdk-core repository contains core functionality required by Go code generated by the IBM OpenAPI SDK Generator.
Apache License 2.0
30 stars 24 forks source link

fix: Pace requests to token server for new auth tokens #55

Closed jorge-ibm closed 4 years ago

jorge-ibm commented 4 years ago

This PR updates the design for token refresh by decoupling the refresh logic from active requests to be consistent with the other cores.

ref: https://github.ibm.com/arf/planning-sdk-squad/issues/1550

jorge-ibm commented 4 years ago

@mkistler @padamstx - I've pushed an amended commit that adds the missing calculation of the refreshTime everytime we get a new token. I've also moved back the property refreshTime to be a part of the iamTokenData and cp4dTokenData structs, respectfully.

As far as the concerns over using locks for network calls, it looks like by default we set a client side timeout of 30 seconds. I've added two new tests to simulate a client side timeout, TestIamGetTokenTimeoutError and a test to simulate a 504 from the server, TestIamGetTokenServerError.

Note: the client timeout doesn't cover the time spent sending a request rather the time spent reading/receiving.

ibm-devx-automation commented 4 years ago

:tada: This PR is included in version 3.3.1 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: