Giter VIP home page Giter VIP logo

Comments (9)

kokarn avatar kokarn commented on June 17, 2024 1

I think handling this yourself is the way to go. It's usually very system dependent what you want to do.

from twitter-lite.

kokarn avatar kokarn commented on June 17, 2024

This is a huge issue actually. Makes it impossible to build something that requests a larger amount of things without a responsible backoff.

from twitter-lite.

peterpme avatar peterpme commented on June 17, 2024

Thanks so much for bringing this up! I'll Add this right now

from twitter-lite.

peterpme avatar peterpme commented on June 17, 2024

So would you all prefer managing the rate limiting errors within twitter-lite or just access to the full response object and manage it yourself?

from twitter-lite.

peterpme avatar peterpme commented on June 17, 2024

#17 fixes it. I'll have to cut a minor release since the API changes. Thanks for bringing this up!!

from twitter-lite.

dandv avatar dandv commented on June 17, 2024

@kokarn and @gnomeontherun, if #17 resolves the issue, feel free to close.

BTW, Twitter also has an API endpoint that returns the rate limit status. You can filter for the endpoints that have dangerously low rate limits like this:

async function checkRateLimits() {
  const rateLimits = await twitter.get('application/rate_limit_status', {
   resources: 'friends,statuses,<OTHER_ENDPOINTS_YOU_USE>',
  });
  // Display rate limits for consumed and not fully replenished API endpoints
  for (const resource of Object.values(rateLimits.resources))
    for (const [endpoint, info] of Object.entries(resource))
      if (info.remaining < info.limit / 2)
        console.warn( `WARNING: used 50%+ of the API endpoint limit for ${endpoint}: ${info}`);
});

from twitter-lite.

kokarn avatar kokarn commented on June 17, 2024

I haven't got the time right now to look into it in detail, but if the response object is returned that's all that's needed for me.

Good to close from me.

from twitter-lite.

dandv avatar dandv commented on June 17, 2024

@kokarn: I've found that throwing errors makes handling rate limit responses ([{"message": "Rate limit exceeded", "code": 88}]) much easier. This sentiment has been echoed by twit users as well.

Unless you have a strong objection, I'm going to make this breaking change before we hit 1.0.

from twitter-lite.

dandv avatar dandv commented on June 17, 2024

This landed in v0.7.0.

from twitter-lite.

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.