Skip to content

Commit 783d502

Browse files
authored
Merge pull request #19 from ahwm/issue18
Updating to allow 3 tries in case of S3 timeout
2 parents cc18acc + cd36d3d commit 783d502

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/SvnManager.WebUI/SvnBackups.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Diagnostics;
88
using System.IO;
99
using System.Linq;
10+
using System.Threading;
1011

1112
namespace SvnManager.WebUI
1213
{
@@ -51,7 +52,26 @@ public static void Upload()
5152
FilePath = file.FullName
5253
};
5354

54-
resps.Add(c.UploadPart(upReq));
55+
int tries = 1;
56+
UPLOAD:
57+
try
58+
{
59+
resps.Add(c.UploadPart(upReq));
60+
}
61+
catch (Exception ex)
62+
{
63+
var origEx = ex;
64+
while (ex.InnerException != null)
65+
ex = ex.InnerException;
66+
67+
if (ex is System.Net.Sockets.SocketException && ex.Message.Contains("connection attempt failed") && tries <= 3)
68+
{
69+
tries++;
70+
Thread.Sleep(30_000);
71+
goto UPLOAD;
72+
}
73+
throw origEx;
74+
}
5575

5676
filePosition += partSize;
5777
}

0 commit comments

Comments
 (0)