Skip to content

strict_types declared but usleep() receives a float #115

@ugurarici

Description

@ugurarici

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

  • I have described this issue in a way that is actionable (if possible)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions