Open KellyFromSales opened 5 months ago
seems to be working now, must have just had to wait!
It's funny, I tried that too and got rate limited. :D
End result is that even the API calls to fetch currently playing is not working.
I hit this last night after starting an import of 400k~ plays going back to 2014.
Spotify has their rate limit API sorta documented. In this they include a Retry-After
header that ideally should be used in a backoff/retry strategy. However, I suspect we have found an undocumented hard limit for number of calls in a 24 hour period.
Here's the sequence of events I see:
Adding the the number of seconds to those two timestamps gives us approximately 3:55 PM, which is 24 hours after the import first started. Odds are I just need to retry the import after I pass that 24 hour window, which is probably why it worked for @KellyFromSales later in the day they posted this issue. Their Retry-After
header only had about 2 hours left at the time of posting.
server-1 | [info] Adding
Hello, I think I found the issue, it is related to how I queue the calls, if the queue is empty I call instantly. Thus when you import your songs it does the calls one by one so the queue is always empty, so the calls are never delayed how they should be.
Started looking on what could be the issue. Turns out my implementation of the queue is not guilty of what's happening. I feel like Spotify changed their rate limits. I cannot see any numbers on their documentation that I have to respect so I'm a bit blind on how to fix. Also, it seems that they send no headers concerning the current state of the rate limites. They only send the retry-after header when it's already too late. I'm looking deeper to see if there is any written rule I can respect. EDIT: Also it would be insane to wait for 429's then having to wait 24 hours before doing the next request 💀
The wait 24h might be a okay ish workaround for the moment though..
EDIT: Is it doing the tracks etc, one by one when importing? I think instead it would be beneficial to do bulk requests if possible? Eg include multiple tracks in one request? EDIT2: Related: https://community.spotify.com/t5/Spotify-for-Developers/Constantly-getting-24-hour-Rate-Limited-during-development/td-p/5814282
The 24 hours wait would stop the whole app from functioning for other users. I request all the infos I need every 20 track processed. Maybe I could increase this number but I don't think this would change radically. Maybe the cleanest way would be to import only 150k entries a day.
Yeah, if you enforce the 24 hour wait it will break ongoing listens from being tracked, and then you'll have gaps in your history.
I think you can work around that 24 hour wait with a rolling counter. Increment every call, and decrement +24hr from the time of that call. You can have a high water mark for when the imports halt, but keep the polling task for active listening still running.
It's not glamorous, but when dealing with undocumented boundaries/limits: you gotta do what you gotta do.
I meant to enforce it for the import only. :)
So now that I tried to clean it up, my instance is in somewhat corrupt state (it auto-updated so the import file(s) stored in /tmp no longer exists), POST /import/full-privacy 400 132.870 ms - 28
and says An import is already running on this account
. How do I recover it?
I think it cleans corrupted imports at start so I guess you could try restarting the container if you did not already try that. Otherwise I ça have a look at that.
I think it cleans corrupted imports at start so I guess you could try restarting the container if you did not already try that. Otherwise I ça have a look at that.
The auto-update had the implication that it did already restart (automatically), which is why it failed but it's still somehow in a state where the import is stuck, and I cannot start a new one.
It seems that it required the restart of both mongo and server, instead of just server for some reason..
Oooof
Describe the bug
I'm trying to import my extended listening history going back to 2010. I was able to import around 65k without issue, but now it always fails
looking through my docker logs, after the 10th retry an error is displayed and it looks like i'm hitting a rate limit.
I've tried making a file only a few entries, the 12 in the example above, but it made no difference. I've tried leaving it overnight with no difference. I've also tried importing a file i know worked previously, but I'm encountering the same issue.
Looking at the docs, it looks like they work on a rolling 30 second api rate limit, so i'm confused what's going on.
Expected behavior
Running an import finishes successfully
Additional context
not sure what other logs might be useful, happy to provide