Skip to content

Commit fbb0866

Browse files
committed
Use the simple way to get delay counter
1 parent a11d8e4 commit fbb0866

File tree

2 files changed

+3
-33
lines changed

2 files changed

+3
-33
lines changed

src/Common/Commands.Common/TestMockSupport.cs

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -47,35 +47,4 @@ public static void Delay(TimeSpan duration)
4747
}
4848
}
4949
}
50-
51-
public class Delay
52-
{
53-
public const int DefaultMaxDelayInMilliseconds = 60000;
54-
55-
public const int DefaultBackoffStepInMilliseconds = 5000;
56-
57-
public const int DefaultDelayInMilliseconds = 0;
58-
59-
private int backoffStep;
60-
61-
private int maxDelay;
62-
63-
private int nextDelay;
64-
65-
public Delay(int backoffStep = DefaultBackoffStepInMilliseconds, int firstDelay = DefaultDelayInMilliseconds, int maxDelay = DefaultMaxDelayInMilliseconds)
66-
{
67-
this.backoffStep = backoffStep;
68-
this.maxDelay = maxDelay;
69-
this.nextDelay = firstDelay;
70-
}
71-
72-
public int GetNextDelay()
73-
{
74-
int delay = this.nextDelay;
75-
this.nextDelay += this.backoffStep;
76-
this.nextDelay = Math.Min(maxDelay, this.nextDelay);
77-
78-
return delay;
79-
}
80-
}
8150
}

src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourceClient.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,17 +325,18 @@ private DeploymentExtended WaitDeploymentStatus(
325325
params string[] status)
326326
{
327327
DeploymentExtended deployment;
328-
Delay stepedDelay = new Delay(firstDelay: 0);
328+
int counter = 0;
329329

330330
do
331331
{
332-
TestMockSupport.Delay(stepedDelay.GetNextDelay());
332+
TestMockSupport.Delay(counter);
333333

334334
if (job != null)
335335
{
336336
job(resourceGroup, deploymentName, basicDeployment);
337337
}
338338
deployment = ResourceManagementClient.Deployments.Get(resourceGroup, deploymentName).Deployment;
339+
counter = counter + 5000 > 60000 ? 60000 : counter + 5000;
339340

340341
} while (!status.Any(s => s.Equals(deployment.Properties.ProvisioningState, StringComparison.OrdinalIgnoreCase)));
341342

0 commit comments

Comments
 (0)