No controls for timeouts.
Opened this issue · 1 comments
miguelortize commented
Great piece of code!
When trying to use the tool, I got a timeout error for WSO2 connection (using DNS, not /etc/hosts):
Could not connect to WSO2: ('Connection aborted.', DNSError(67, 'request timed out'))
I looked at the configuration files and everything was just fine (graphit-tool.py was working before!).
After reviewing the code and debugging the connection to IAM, I found that the first time it tried to connect, it failed with a timeout, the WSO2 logs did not show any attempt to connect (usually would get a 401 error), but if you send a second request to connect it would take it (200).
Quick ugly workaround:
try:
session.auth = WSO2AuthClientCredentials(
config.get('wso2', 'url'),
client = (
config.get('wso2', 'clientid'),
config.get('wso2', 'clientsecret')
),
verify=wso2_verify)
except:
try:
session.auth = WSO2AuthClientCredentials(
config.get('wso2', 'url'),
client = (
config.get('wso2', 'clientid'),
config.get('wso2', 'clientsecret')
),
verify=wso2_verify)
except WSO2Error as e:
print >>sys.stderr, e
sys.exit(10)
Looping would get it to work.
mklemm2 commented
Thanks, I will try to generalize this. The goals should be:
- Arbitrary number of repetitions (as you said, looping)
- Exponential backoff, so it doesn't stress an possibly already overloaded WSO2 with additional thousand connections per second.
- A (configurable) timeout.