Skip to content

Commit

Permalink
Merge pull request #14 from karlmonson/master
Browse files Browse the repository at this point in the history
Fixed a 'Division by Zero' error in the sleepIfRateLimited() method.
  • Loading branch information
joecampo committed Mar 16, 2019
2 parents bbb497e + 92e742b commit 933cbb7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ShipStation.php
Expand Up @@ -127,7 +127,7 @@ public function sleepIfRateLimited(Response $response)
$rateLimit = $response->getHeader('X-Rate-Limit-Remaining')[0];
$rateLimitWait = $response->getHeader('X-Rate-Limit-Reset')[0];

if (($rateLimitWait / $rateLimit) > 1.5) {
if ($rateLimit === 0 || ($rateLimitWait / $rateLimit) > 1.5) {
sleep(1.5);
}
}
Expand Down

0 comments on commit 933cbb7

Please sign in to comment.