picqer/picqer-php

Method handleRateLimitReached wrong implemented in sendRequest method

kevinkoenen opened this issue · 2 comments

Hi Picqer,

In the Client.php is the method handleRateLimitReached wrong implemented.
The local $headerInfo variable in the method sendRequest will never be updated again after calling handleRateLimitReached.

To fix this, you have to return the result of the handleRateLimitReached directly instead of saving it to the $result variable.

See https://github.com/picqer/picqer-php/blob/main/src/Client.php#L1188C33-L1188C33 for more information.

Instead of

$result = $this->handleRateLimitReached($endpoint, $params, $method, $filters);

Fix:

return $this->handleRateLimitReached($endpoint, $params, $method, $filters);

With kind regards,
Kevin Koenen

Good find @kevinkoenen. We use this ourselves a lot, but never hit this bug. But it definitely was wrong. I now fixed it in the newest release. Thanks!

Thanks Casper for the quick response and fix!