Giter Club home page Giter Club logo

Comments (4)

cnguy avatar cnguy commented on May 28, 2024

@cczeus
probably because the rate limiter used (same rate limiter used for leaguejs, it's nice) spread strategy is used by default
still gotta allow users to set the config to include burst: true or whatever (which can be added today since it's simple and the rate limiter already has two strategies which are spread(default) & burst)

once burst is added, syncing should take 1-3 seconds (not sure), and then all the calls should be completed instantly

it's definitely async though

from kayn.

cczeus avatar cczeus commented on May 28, 2024

If you don't mind answering, what is the point of spread? To my understanding it's to prevent possible 429 responses, but isn't it theoretically impossible to get a 429 as long as you respect the rate limits and retry after in the header? Is there something I'm missing?

from kayn.

cnguy avatar cnguy commented on May 28, 2024

@cczeus
i believe spread is necessary if you do not sync your rate limiters at the beginning, which kindred-api did not do, but Colorfulstan's rate limiter does (as well as Zed.gg).

Spread also helps you not get timed out too early if you're doing a lot of async processing like if you're trying to generate one tricks from every region/master-challenger at once https://github.com/cnguy/OneTricks/blob/master/server.js..
speaking of timing out, im not sure if the limiter has a timeout option + i don't have a timeout config

April 27 Edit

If you don't mind answering, what is the point of spread? To my understanding it's to prevent possible 429 responses, but isn't it theoretically impossible to get a 429 as long as you respect the rate limits and retry after in the header? Is there something I'm missing?

I don't think I answered this well so I am editing this question in case anyone stumbles upon it.

Spread is a lot better (mostly safer) for production keys. Sometimes, the rate limiter this library depends on may get out of sync. This mostly happens when you're making a huge number of parallel requests (e.g. multiple regions, 1000 requests per 10 seconds each). If you burst here, and the rate limiter happens to go out of sync (maybe our requests were really slow), you WILL get a 429 and most likely get a bunch more since the rate limiter thinks it is safe when it is not.

from kayn.

cnguy avatar cnguy commented on May 28, 2024

@cczeus should work now, i tried it out and every time the rate limits were synced for a particular endpoint, the other requests finished instantly

it won't finish in a second because each request to a different endpoint requires a sync, but ofc you won't blow up your key by accident (which i have done several times with kindred-api).

from kayn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.