Function
retry
(func, *args, back_off=0.5, limit=5, **kwargs)
Source from the content-addressed store, hash-verified
| 10 | |
| 11 | |
| 12 | def retry(func, *args, back_off=0.5, limit=5, **kwargs): |
| 13 | for i in range(limit): |
| 14 | try: |
| 15 | return func(*args, **kwargs) |
| 16 | except Exception: |
| 17 | print("Retry in {} seconds...".format((i + 1) * back_off)) |
| 18 | time.sleep((i + 1) * back_off) |
| 19 | |
| 20 | raise Exception( |
| 21 | "Unable to successfully receive result from {}".format(func)) |
| 22 | |
| 23 | |
| 24 | def get_scope(collection_mgr, scope_name): |
Tested by
no test coverage detected