Comments (14)
@terrisgit @nirtayeb @cjw296 max_time
is now supported in master - I will probably release as backoff=1.5
from backoff.
@tjboring thanks for the nudge. backoff==1.5.0
is now released and in pypi
Thanks all.
from backoff.
@terrisgit You can use max_tries
to effectively set this maximum (though it might be inconvenient because you need to do the math taking into account the wait generator you're using) but @cjw296 is correct that when using full jitter max_tries
is not deterministic in defining the minimum wait time.
For example if you specify max_tries=3
and get three (un?)lucky full jitter rolls, you might retry for a significantly shorter overall period than expected based on your wait generator.
I'll plan to add a max_time
keyword arg.
from backoff.
Yes, a maximum is needed to avoid crazy waits like 10,000 seconds
from backoff.
@cjw296 There's a max_time
implementation here #48
I'll give it some more testing before I merge is to master, but let me know if you have any feedback in the meantime.
from backoff.
Awesome! I'll give it a try.
max_tries in my use case is infinity, or until the process receives SIGINT. I guess I should submit another issue for infinity. I'm just using 1 billion for now.
from backoff.
@bgreen-litl - thanks! Unfortunately, it's been so long since I submitted this issue that I no longer have the use case to hand. Looks like others are able to test, though, so good luck!
from backoff.
@terrisgit The default is infinite retries - simply don't specify max_tries
.
BTW, if you're concerned with the individual wait times (as opposed to total retry time) max_value
is already supported.
Also, sounds like the SIGINT thing is a problem for async - in my experience everything shuts down cleanly in the synchronous case. I need to put some thought into and do some research on the best way to handle shutdown for async.
from backoff.
Me want max_tries=3 when I unit test, infinity when I do not. I never thought of trying None.
from backoff.
The SIGINT thing is a problem when the sleep timeout is large. Due to my ignorance of max_value, this was a bigger deal for me than it is now. The request to stop sleep for coroutines only is #47 (if you don't already have your own signal handler, you probably don't care about this issue)
from backoff.
I would benefit from having it as well
from backoff.
I will be trying the max_time PR soon.
from backoff.
any sense of when the release will be made? just curious, as i'm looking forward to using it.
from backoff.
👍
from backoff.
Related Issues (20)
- Duplicate logging in some special cases HOT 1
- How do I use this?
- Obtain value returned by backoff_handler function after maximum tries is reached
- max_retries HOT 1
- max_time only applies _after_ first retry?
- Canonical way to handle error bursting
- Add exponential decay
- How to handle backoff on Facebook cursor? HOT 1
- Improve Typing and Error Handling in `on_exception`
- question about max_time
- Feature Request: add a way to use backoff in a context manager HOT 2
- feature request: toggle decorator on/off
- `backoff.on_predicate` does not work for `staticmethod`s
- Expose typing hints as they are part of the API
- Add support for globally disabling retries
- How to provide arguments to `on_backoff` function HOT 1
- Feature Request: support direct invocation with functools.partial
- Maintenance help? HOT 7
- README: `max_value` arg to `@backoff.on_predicate(backoff.fibo...)` -- if not obsolete, then maybe just confusing?
- Prevent error message in case of giveup using
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from backoff.