Timeout function to stop the execution if no SFTP connection is established.
()
| 304 | return 'failed' |
| 305 | |
| 306 | def timeout(): |
| 307 | """ |
| 308 | Timeout function to stop the execution if no SFTP connection is established. |
| 309 | """ |
| 310 | if not self.sftp_connected: |
| 311 | logger.error(f"No SFTP connection established within 4 minutes for {ip}. Marking as failed.") |
| 312 | self.stop_execution = True |
| 313 | |
| 314 | timer = Timer(240, timeout) # 4 minutes timeout |
| 315 | timer.start() |