4 ms·
Hardcoded sleeps for some reason, nice /s https://github.com/cgzirim/not-shazam/blob/888070f3434acbc0a59a3cad8972eba3c359ee27/spotify/downloader.go#L34 https:/
by wmichelin 2y ago
Hardcoded sleeps for some reason, nice /s
https://github.com/cgzirim/not-shazam/blob/888070f3434acbc0a59a3cad8972eba3c359ee27/spotify/downloader.go#L34 https://github.com/cgzirim/not-shazam/blob/888070f3434acbc0a...
- rvnx 2y agoIt's to go around the ban of the IP / account by Spotify and to be softer with them, you have to wait between two requests to download songs.
- lucb1e 2y agoI also use sleep a lot in my code when interfacing with third-party services (multiprocess usually so it's not blocking things, though I'd also totally see myself using a callback pattern or so if the caller can handle those). When it's more than an ad-hoc piece of code, it generally measures how long ago the previous request finished to determine how long to sleep if the next call is made within the cool-off period. If you're not doing that... please don't interface with my server