Skip to content

Commit

Permalink
renew access token 10s before it expires
Browse files Browse the repository at this point in the history
  • Loading branch information
topi314 committed Jan 29, 2022
1 parent 2440f07 commit 4fc72c2
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public SpotifySourceManager(SpotifyConfig config, AudioPlayerManager audioPlayer
try{
var clientCredentials = this.clientCredentialsRequest.execute();
this.spotify.setAccessToken(clientCredentials.getAccessToken());
Thread.sleep(clientCredentials.getExpiresIn() * 1000);
Thread.sleep((clientCredentials.getExpiresIn() - 10) * 1000L);
}
catch(IOException | SpotifyWebApiException | ParseException e){
log.error("Failed to update the spotify access token. Retrying in 1 minute ", e);
Expand Down

0 comments on commit 4fc72c2

Please sign in to comment.