Using the Retry for FTP upload

0 votes
asked May 15, 2013 by DBA_Jeremy (140 points)
edited May 16, 2013

I'm trying to force a retry with a 30 minute delay when an FTP Upload fails due to connectivity issues. Here's a snippet of my code. Is this how the retry is to be used in conjuction with the BatchTransferProblemDetected event?

Sub RetryUpload(ByVal sender As Object, ByVal e As FtpBatchTransferProblemDetectedEventArgs)
    'Wait 30 minutes and try again
    'Do this for the next 4 hours before failing
    Retries += 1
    If Retries < 9 Then
        System.Threading.Thread.Sleep(1800000)
        e.Action = FtpBatchTransferAction.Retry
    Else
        e.Action = FtpBatchTransferAction.ThrowException
    End If
End Sub

1 Answer

0 votes
answered May 16, 2013 by Tomas Knopp (58,580 points)
edited May 16, 2013

Well in fact, the whole batch transfer (including handling problems with BatchTransferProblemDetected event) is done within one FTP session.

So if a problem is detected during batch transfer, we would not advise to perform a long Thread.Sleep(). You must take into account that after 30 minutes of session inactivity the server would probably consider that the connection was dropped and disconnect your FTP client.

...