(func, *args, max_retries=2, **kwargs)
| 71 | """ |
| 72 | |
| 73 | def safe_command(func, *args, max_retries=2, **kwargs): |
| 74 | for attempt in range(max_retries): |
| 75 | try: |
| 76 | return func(*args, **kwargs) |
| 77 | except ConnectionError: |
| 78 | if attempt < max_retries - 1: |
| 79 | time.sleep(1.0) |
| 80 | try: |
| 81 | api_client.disconnect() |
| 82 | api_client.connect() |
| 83 | except Exception: |
| 84 | pass |
| 85 | except Exception: |
| 86 | pass |
| 87 | |
| 88 | safe_command(api_client.disconnect_device) |
| 89 | safe_command(api_client.disable_csv_export) |
no test coverage detected