GithubHelp home page GithubHelp logo

Parity with yab ratelimit about ratelimit HOT 6 CLOSED

uber-go avatar uber-go commented on July 24, 2024
Parity with yab ratelimit

from ratelimit.

Comments (6)

kriskowal avatar kriskowal commented on July 24, 2024

A change of this kind would require a major version bump. It could be done, since nothing we know of uses this package yet. Ideally we would use this package as a dependency in yab. I’d like to know what @prashantv thinks.

from ratelimit.

kriskowal avatar kriskowal commented on July 24, 2024

To clarify, the difference is that yab’s take accepts a cancel channel.

from ratelimit.

prashantv avatar prashantv commented on July 24, 2024

Since we haven't cut any releases, I think it's fine to change the interface.

I think the ideal interface would take a context.Context for cancellation.

from ratelimit.

achals avatar achals commented on July 24, 2024

So I have a branch locally that updates the interface to accept a context.Context; it seems to be mostly working but ExampleRateLimit has way more variance than earlier:

--- FAIL: ExampleRatelimit (0.09s)
got:
1 10.935692ms
2 9.814699ms
3 11.718343ms
4 9.582154ms
5 8.356239ms
6 12.062452ms
7 8.729969ms
8 8.911591ms
9 9.937449ms
want:
1 10ms
2 10ms
3 10ms
4 10ms
5 10ms
6 10ms
7 10ms
8 10ms
9 10ms
FAIL

Again, go newb, but is switching to using select to block on channels supposed to add that kind of over head? I can make a PR if it helps the discussion.

from ratelimit.

achals avatar achals commented on July 24, 2024

Ignore my earlier comment, I was misusing the Clock interface, which I've actually removed in my PR.

from ratelimit.

nathanhack avatar nathanhack commented on July 24, 2024

Is there a status on when the PR for this might be merged?

from ratelimit.

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.