slince / shopify-api-php

:rocket: Shopify API Client for PHP
MIT License
128 stars 47 forks source link

Auto limit doesn't work well #64

Closed baorv closed 3 years ago

baorv commented 4 years ago

I got this error when using this package to fetch order information

429 Too Many Requests response: {"errors":"Exceeded 0 calls per second for api client. Reduce request rates to resume uninterrupted service." `

imandydoan commented 4 years ago

How can I handle error 429 in this package? @slince

slince commented 4 years ago

Hello; You can catch this exception and do something else;


try {
    $currentProducts = $pagination->current(); //current page

    while ($pagination->hasNext()) {
        $nextProducts = $pagination->next();
    }
} catch (Slince\Shopify\Exception\ClientException $e) {
       dump($e);
}
imandydoan commented 4 years ago

I think that error 429 should be implemented in this package. I see that you implement it in this line: https://github.com/slince/shopify-api-php/blob/master/src/Client.php#L344

But I still got this error.

baorv commented 4 years ago

As you can see this package from bold-commerce/bold-shopify-toolkit.

https://github.com/bold-commerce/bold-shopify-toolkit/blob/master/src/Services/Client.php#L305

https://github.com/bold-commerce/bold-shopify-toolkit/blob/master/src/Support/ShopifyApiHandler.php

slince commented 3 years ago

fixed