Git Product home page Git Product logo

Comments (6)

gnikyt avatar gnikyt commented on July 28, 2024

@kneeki The rate limiting is not for (your code), its the rate limiting support for Shopify API calls.

The package implements a very simple version of this, you're allowed to hit Shopify's API twice in one second for regular shops, or four times in one second for Plus shops.

Whats the limiter does, is it checks the header returned by Shopify. The header contains how many calls you used and have left. If you run out of calls, the library will sleep until it can gain calls back.

Does that help?

from basic-shopify-api.

kneeki avatar kneeki commented on July 28, 2024

from basic-shopify-api.

gnikyt avatar gnikyt commented on July 28, 2024

It calculates a wait time and sleeps.

from basic-shopify-api.

amosmos avatar amosmos commented on July 28, 2024

Hey,

Two quick questions regarding the conversation in this issue:

  1. You mention the limiter checks the header returned by Shopify, but in the code it seems it just keeps the timestamp of the last request it issued, and calculate the sleep time based on that, so not real check based on the Shopify header - am I missing something?

  2. If I didn't miss anything, that means the limiter only "knows" about recent requests made by itself, so in the case of the OP, when the requests are made by separate jobs, the limiter will not know about the other requests - am I right or wrong?
    Of course if I'm wrong in question #1 and the limiter does check the header by Shopify, it will support rate limiting requests from separate jobs, so I hope I am wrong :-)

Thanks!
Amos

from basic-shopify-api.

gnikyt avatar gnikyt commented on July 28, 2024

from basic-shopify-api.

amosmos avatar amosmos commented on July 28, 2024

Thanks!

It makes perfect sense.

So would you recommend to check if a request had a rate limit issue and in that case use the getApiCalls function to check when run it again?
I can assume this function can be the basis for an internal mechanism that will automatically run the call again until a different response is sent (I think there's a different issue for that which you said you might work on in the future).

Also, I'm not an expert on static values so correct me if I'm wrong, but I believe that won't help in case of async queue jobs calling the api.

THANKS!
Amos

from basic-shopify-api.

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.