Retry boto.swf connection to avoid frequent errors when using IAM roles #99
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements a dumb "retry" solution to #26. Centralizing things is not easy in a multi-process environment, and the built-in boto option is config dependent and I'm not sure how to handle it properly, while the proposed solution works in multiple cases.
I tested it by running the following script:
... in parallel: I triggered it from the shell and left it in the background a dozen times, like this:
Hence I had many concurrent processes trying to connect to SWF.
Without the fix, I got the following error once:
And the following error 5 times:
This is also an error we get from time to time in production.
With the fix, the retries kicked in so I just got notifications of the retries on stdout:
I'm not sure it will be easy to test that properly in the test suite, so I leave it with no test (the "retry" decorator itself is tested obviously).
poke @ybastide @benjastudio