Shopify / shopify-api-php

MIT License
378 stars 172 forks source link

strict_types declared but usleep() receives a float #115

Closed ugurarici closed 2 years ago

ugurarici commented 2 years ago

Issue summary

Shopify returns Retry-After header as a float. So when we run usleep($retryAfter * 1000000); on Clients/Http.php Line 204 it throws a TypeError Exception as seen here:

TypeError: usleep(): Argument #1 ($microseconds) must be of type int, float given in /home/user/project/vendor/shopify/shopify-api/src/Clients/Http.php:204

Expected behavior

Instead of throw an exception it should work and delays the program's execution for given microseconds.

Actual behavior

What actually happens?

Throws a TypeError Exception as seen here:

TypeError: usleep(): Argument #1 ($microseconds) must be of type int, float given in /home/user/project/vendor/shopify/shopify-api/src/Clients/Http.php:204

Steps to reproduce the problem

  1. Throttle the api above your rate limit and you will encounter with TypeError Exception.

Checklist

paulomarg commented 2 years ago

Hi @ugurarici, great catch, we'll fix this!