retry-decorator icon indicating copy to clipboard operation
retry-decorator copied to clipboard

Decorator for retrying when exceptions occur

Results 3 retry-decorator issues
Sort by recently updated
recently updated
newest added

Main highlights: a) allow defining `callback_by_exception` as a `{function,tuple,list}`; b) default `run_one_last_time` to True even if callback_by_exception is defined; c) add tests d) validate `tries` attribute is >= 1

See https://github.com/pnpnpn/retry-decorator/blob/master/retry_decorator/retry_decorator.py#L34: when `callback_by_exception` is defined and in effect, then `run_one_last_time` is defaulted to `False`. 1. why is it so? 2. what's the purpose of `run_one_last_time` to begin with? To...

Is it possible to execute some code before retrying? For example: ``` try: return function(base_db, sql_string, sql_vars, debug_sql) except (AttributeError, MySQLdb.OperationalError): base_db.__init__() return self.retry_db_errors(function(base_db, sql_string, sql_vars, debug_sql)) ```

enhancement