Skip to content

Commit b005064

Browse files
author
Graeme Foster
committed
Putting some more heart into this.
1 parent 4623c23 commit b005064

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

AzureWebFarm.OctopusDeploy/Infrastructure/OctopusDeploy.cs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,20 @@ private void HandleFailedRemoval()
7878

7979
public void DeleteMachine()
8080
{
81-
try
81+
var remainingAttempts = 5;
82+
while (remainingAttempts > 0)
8283
{
83-
DeleteMachineInternal();
84-
}
85-
catch (Exception e)
86-
{
87-
Log.Error(e, "Initial attempt to remove machine from Octopus repository failed. Will retry 1 time.");
88-
DeleteMachineInternal();
89-
Log.Information("Successfully deleted machine from Octopus repository");
84+
try
85+
{
86+
DeleteMachineInternal();
87+
return;
88+
}
89+
catch (Exception e)
90+
{
91+
remainingAttempts--;
92+
Log.Error(e, "Initial attempt to remove machine from Octopus repository failed. Will retry {attempts} time(s).", remainingAttempts);
93+
Thread.Sleep(TimeSpan.FromSeconds(3));
94+
}
9095
}
9196
}
9297

0 commit comments

Comments
 (0)