Skip to content
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

Change request timeout and retry values on the fly #97

Closed
moggers87 opened this issue Mar 4, 2014 · 6 comments
Closed

Change request timeout and retry values on the fly #97

moggers87 opened this issue Mar 4, 2014 · 6 comments

Comments

@moggers87
Copy link
Collaborator

The fix for #96 has left us in the position where we need to subclass PyPump to change the request timeout and retry values. That is quite silly.

@tsyesika
Copy link
Owner

tsyesika commented Mar 7, 2014

How would we want this to work, having attributes on the class?

pump = PyPump(...)
pump.set_timeout(60) # 60 seconds
pump.set_retry(3) # 3 retries before giving up

Something like that?

@RouxRC
Copy link
Contributor

RouxRC commented Mar 7, 2014

Why not simply add them as keyword arguments for PyPump ?

@tsyesika
Copy link
Owner

tsyesika commented Mar 7, 2014

PyPump's initialisation kwargs got very crowded before, I am trying to limit how much can be passed to PyPump's initialisation to try and make it more readable and less overbearing.

@moggers87
Copy link
Collaborator Author

Class attributes are probably the way to go. Couldn't we have the timeout being set on the client? (though PyPump's kwargs are shorter than Client's) Not sure if that would make sense though.

@tsyesika
Copy link
Owner

tsyesika commented Mar 7, 2014

Ah yes setting them in some initialise might be useful as some requests are done on the initialisation. I'm not sure they belong on the client though as the client uses pypump to make the requests

@tsyesika
Copy link
Owner

This can now be achevied either by changing the .timeout or .retries variable or passing your own in to the PyPump object.

pump = PyPump(client=client, retires=10, timeout=5)
pump.retires = 2
pump.timeout = 2

Somewhat confusingly and this might need to be brought up in a followup issue retries=1 actually only makes 1 attempt and retries=0 never makes a request. This is because retires is actually how many requests are attempted rather than how many follow up requests are attempted when the initial request fails.

kabniel added a commit that referenced this issue Sep 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants