The actual wrapper function that applies the retry logic.
(*args, **kwargs)
| 199 | """Wrapper function factory invoked by decorator magic.""" |
| 200 | |
| 201 | def wrapped_fn(*args, **kwargs): |
| 202 | """The actual wrapper function that applies the retry logic.""" |
| 203 | for delay in delays(): |
| 204 | try: |
| 205 | return fn(*args, **kwargs) |
| 206 | except Exception as e: # pylint: disable=broad-except |
| 207 | if is_retriable is None: |
| 208 | continue |
| 209 | |
| 210 | if is_retriable(e): |
| 211 | time.sleep(delay) |
| 212 | else: |
| 213 | raise |
| 214 | return fn(*args, **kwargs) |
| 215 | |
| 216 | return wrapped_fn |
| 217 |