Skip to content
This repository has been archived by the owner on Jul 22, 2021. It is now read-only.

max_retries #60

Open
askreet opened this issue Oct 7, 2013 · 2 comments
Open

max_retries #60

askreet opened this issue Oct 7, 2013 · 2 comments

Comments

@askreet
Copy link

askreet commented Oct 7, 2013

In many places in the PHP SDK max_retries is compared using the <= operator, resulting in a max_retries of 0 meaning "retry once". I found this comparison in 5+ source files, here is the example I hit:

    # (Line 948 sdk.class.php)

    if ($this->redirects <= $this->max_retries)
    {
        // Exponential backoff
        $delay = (integer) (pow(4, $this->redirects) * 100000);
        usleep($delay);
        $this->redirects++;
        $data = $this->authenticate($operation, $original_payload);
    }
@rquadling
Copy link

0 === max_retries === try initially, but don't retry if the request fails.
1 === max_retries === try initially, and retry once if the request fails.
etc.

At first glance, this would seem to be appropriate behaviour.

@askreet
Copy link
Author

askreet commented Oct 8, 2013

This retry loop is a recursive call to itself. So if this if() is executed, it's after a failure has already occurred. See sdk.class.php line 964 where the request is already sent, then line 983 where the code I pasted is wrapped in an "if the response is 500 or 503.."

Another file this occurs in is ec2.class.php -- probably happens in each service that uses max_retries.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants