New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wait_for_connection timeout/retries fixes #75388
base: devel
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The added tests are awesome.
max_end_time = datetime.utcnow() + timedelta(seconds=timeout) | ||
|
||
e = None | ||
while datetime.utcnow() < max_end_time: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you could simplify this. The _total_seconds
shim doesn't seem necessary since those Python versions aren't supported anyway.
while datetime.utcnow() < max_end_time: | |
while datetime.utcnow() < max_end_time: | |
if (datetime.utcnow() + timedelta(seconds=connect_timeout)) > max_end_time: | |
# connect_timeout is longer than the max time left, so use the remaining time instead | |
connect_timeout = int((max_end_time - datetime.utcnow()).total_seconds()) | |
if connect_timeout < 1: | |
# invalid timeout or only a fraction of a second is left | |
break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh that's much simpler. I modified the suggestion slightly so it doesn't reassign to the connect_timeout argument and so it uses the same value for 'now' throughout an iteration of the while loop (good practice for guarding against timing edge cases).
@lilatomic This PR contains |
for python<3.2 and python <2.7
not supported any more
thanks s-hertel
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
looks like a flaky CI? I don't think this would affect the galaxy setup
|
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
SUMMARY
fixes #74237
Sets the
timeout
and disablesretries
on the connection.Also improves the timeout behaviour so it won't exceed the maximum timeout specified.
ISSUE TYPE
COMPONENT NAME
wait_for_connection
ADDITIONAL INFORMATION
Before:
After:
We can see that the elapsed time no longer exceeds the timeout