RafaelSolVargas / Vulkan

A Discord BOT to play music from Youtube, Spotify and Deezer
MIT License
99 stars 31 forks source link

Is there a way to get around the HTTP Error 429 "too many requests" error #32

Closed IntensityNetwork closed 1 year ago

IntensityNetwork commented 1 year ago

I get the HTTP Error 429 "Too many requests" when I try to use a playlist bigger than 100 songs on Spotify.

RafaelSolVargas commented 1 year ago

Hi, thanks for the issue

Yeah, I should be uploading a patch by tomorrow after analyzing this problem more precisely.

RafaelSolVargas commented 1 year ago

I was unable to reproduce this error locally, could you please show me a screenshot of the error and send me the exact playlist you are having problems with?

IntensityNetwork commented 1 year ago

Hi, sorry for the delay in getting back to you, I did some further testing and it seems that eventually most of the time (Not all of the time) the bot does actually start playing the songs it just takes a long time (Probably depending on the size of the playlist) when it does eventually start playing the buttons (Play, Stop, Skip etc) don't seem to respond and it throws an error.

I attached some screenshots of the console spam as well as the error for the buttons. I wasn't able to get a screenshot of it but it also appears that the bot reloads/restarts a few times during the console spam (It shows the "Starting Vulkan" message multiple times in the middle of the spam)

Here's an example playlist that has caused it to crash/take a significant amount of time to start playing: https://open.spotify.com/playlist/15sZyUgStYmvzm3QfdVDIp?si=c27c0359c5064dd5

Termius_rxZhuekhd6

Termius_WIr2o6mL8o

I also attached a screenshot of a message relating to a cache file which I'm not sure is related?

image_2023-01-24_192723548

RafaelSolVargas commented 1 year ago

Yes, I found this delay to play the songs when the input is a large playlist I kinda solved this problem in this commit When the playlist contains more than 10 songs, the Bot will prioritize the download and start playing the first 5 songs instead of downloading all the songs in the playlist.

About the buttons, they are not the best thing implemented by the pycord library, as they have a lifetime, after some time they cannot be used anymore, I tried to avoid this problem by disabling the buttons before the end of their lifetime (What is a behavior that I can't change), but that doesn't work every time, if you find any pattern to throw this error I would like to know that.

About the cache, it is not implemented by this project, maybe it is from the library responsible for downloading songs from Youtube, yt-dlp, this library usually launches some random prints on the console.

The Starting Vulkan message shows up when a Process is created to play the song in one channel or when some error occured and the process is restarted, skipping to the next song.

Try to git pull the latest version of Vulkan and see if the delay to starting playing the songs is fixed.

IntensityNetwork commented 1 year ago

Hi, I just tested the bot and I think you have "fixed" the problem with the delay in playing the songs, however "I think" not 100% I think if you disconnect the bot using either the stop button or a command to disconnect the bot from VC and then try playing another playlist or even the same playlist the bot has to finish downloading the songs from the previously requested playlist before it can start downloading the newly requested one.... If that makes sense?

RafaelSolVargas commented 1 year ago

Yes, this is the current behavior, the bot contains a main process that listens to all commands received by Discord and a process for each guild to play the songs, so there is no chance that downloading too many songs will degrade the quality of the music playing. However, the main process, also responsible for downloading the songs, cannot perform these operations instantly, there is a delay to download the songs and the Stop command currently does not cancel all the threads triggered to download the songs, there is no control for that.

I fixed an issue I ran into when you would stop and play again like you said, but it doesn't change the current behavior of the Bot.

RafaelSolVargas commented 1 year ago

I'm closing the issue as completed, any question don't mind opening other issue, thanks for your time and effort