sftp icon indicating copy to clipboard operation
sftp copied to clipboard

Retry if download fails

Open lucazav opened this issue 3 years ago • 2 comments

Is there a way to retry to download a file if sftp_download fails the first time?

lucazav avatar Dec 06 '21 14:12 lucazav

I recommend that you solve that by making your call to sftp_download inside a control structure like while-loop, which starts all over again until a certain condition is met. Also, the reason for a failure could be several, such as the file not found or connection time out. They best way to handle a failed download will depend on what the reason for the failure was. For example, if it is an actual error message that you want to handle, you proably want to write something with tryCatch().

stenevang avatar Dec 06 '21 14:12 stenevang

I saw that sftp_<...> functions allow curl_options as parameter. I'm wondering if passing the --retry-all-errors parameter as explained here would cause the function doing retry. I'll try it asap.

lucazav avatar Dec 13 '21 12:12 lucazav