-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
On predicate #70
On predicate #70
Conversation
@dhirschfeld @estahn Before I dive into this1 – opinions? Footnotes
|
src/stamina/_core.py
Outdated
On = Union[ | ||
Type[Exception], Tuple[Type[Exception], ...], Callable[[Exception], bool] | ||
] |
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'm not a big fan of the name. on: On
doesn't convey any meaning to the reader of the code.
My own inclination would be to try and give some meaning to the name - e.g. on: exc_or_predicate
. It's not perfect, but I think it's probably better than conveying no meaning in the name.
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.
Renamed to ExcOrPredicate
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.
Just some stylistic comments which @hynek can decide upon, otherwise I think it looks good.
Resolves #63 |
Does this need documentation or an example for the docs? |
impeccable timing :D |
I've just added the docs and am heading to the gym. If y'all could have look at them until I'm back that would be appreciated: https://py-stamina--70.org.readthedocs.build/en/70/ |
Looks good to me, although I realise it doesn't fully support my use-case I think. We integrate with a large number of different API vendors and each have their own quirks. One of them being the handling of quota's. Some of those API's will respond with a 429 and provide quota details like time to next retry. I figured I could use this information as the basis for the retry mechanics, but Similar to this example. As for this PR 👍🏼 🚀 |
So what you want is being about to return a float that means "yes, but at least this long"? Feel free to open a discussion about it, ideally with a simplified requirement vs whole blog post. 😇
Thanks! |
@hynek Thanks for merging. Is there anything else required before releasing this? |
Allow on to be a predicate