8

I wrote an algorithm that incorporates a 3rd party API. and the algorithm is so fast and optimized that I started to get 429 status codes from the third party API, asking me to slow down my requests, which I didn't think was an issue when I tested on local env.

Now I'm on purpose slowing down my code, to prevent that from happening.

Talk about suffering from success.

Comments
  • 0
    What about waiting for the requests to finish?
  • 1
    @c3r38r170 it is factored in, ofc. I need to take those responses and work with it as well.
  • 0
    @SidTheITGuy are you sure you use keep-alive / a session so you don't have to connect every time?
  • 1
    @retoor it's a REST API so I don't think it's applicable
  • 3
    Can't you cash responses to off-load some of the requests to memory? Or make larger/batch requests of possible?

    429 are just part of life
  • 3
    Fast and optimized algorithm:
    while true; do
    wget ...
    done
  • 0
  • 0
    I experienced this a week ago.
    I was running a fuckton of promises making requests to an API in parallel using Promise.all to wait for their completions.

    I've had to refactor the whole thing to be sequential...
Add Comment