Giter VIP home page Giter VIP logo

Comments (5)

bgreen-litl avatar bgreen-litl commented on July 22, 2024 1

@k-funk I think I'm going to make regular retries (on_backoff) log as INFO rather than ERROR for 1.5

from backoff.

k-funk avatar k-funk commented on July 22, 2024

+1
I've put logging.getLogger('backoff').setLevel(logging.CRITICAL) into my application because I find the default logging to be too verbose.

def giveup_handler(details):
    raise Exception('Too many tries: {}'.format(details['tries']))

@backoff.on_predicate(backoff.expo, predicate_fn, max_tries=3, on_giveup=giveup_handler)
def get_item():
    pass

Somewhat Related:
Since the max_retries kwarg doesn't make the function actually raise an Exception, I have to write that silly def giveup_handler, but then the details still get logged even though I'm handling the giveup myself, which I find odd.

from backoff.

bgreen-litl avatar bgreen-litl commented on July 22, 2024

Hm for your second point, when max_tries is exhausted, the exception will be let through. Are you not seeing that?

>>> import backoff
>>> @backoff.on_exception(backoff.expo, Exception, max_tries=3)
... def foo():
...     raise Exception('foo')
...
>>> foo()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../backoff/backoff/_sync.py", line 141, in retry
    ret = target(*args, **kwargs)
  File "<stdin>", line 3, in foo
Exception: foo

from backoff.

k-funk avatar k-funk commented on July 22, 2024

Not referring to my fn raising an exception. I'm mostly referring to the backoff decorator: it doesn't raise an exception when max_tries is reached, which seems to be by design. I just find this odd because it logs as if an exception was thrown (logging.error).

from backoff.

bgreen-litl avatar bgreen-litl commented on July 22, 2024

Here is another vote for lower priority default logging for exceptions.
#33

from backoff.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.