-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor client API #61
Conversation
src/lib/http/HttpManager.ts
Outdated
} | ||
|
||
this.config.accessToken = res.data.access_token; | ||
if (retryAmount === 5) { | ||
if (statusCode >= 500 && statusCode < 600) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just reverted back changes made in one of the recent refactoring 4d6aeb9#diff-7a66a64f88500ed3f05b25e049670886f374899bcf5bfcd1a850c19ebaeff100L86-L92 because they cause the token update to fail after the first 5xx response status
src/lib/SpotifyAPI.ts
Outdated
constructor(config: SpotifyConfig) { | ||
this.config = config; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know of multiple projects that are using the <SpotifyApi>.config
to retrieve the configuration options and update the tokens through there, due to the removal of this line of code it's not possible anymore. I would advice to set it as public in the constructor directly, saves some lines and then it isn't a breaking change for other projects that are making use of this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for sharing @stijnvdkolk, will improve the solution according to this fact. Maybe we have anything else details which may make sense for the library clients?
} | ||
await sleep(retryAfter * 1_000); | ||
|
||
requestConfig.retryAttempt = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As previously we don't limit rate limit response retries, and reset counter in case when this status appeared while we did retries for other statuses
manager) instance between all SpotifyAPI sub-managers