Skip to content

Commit df49015

Browse files
authored
Merge pull request Azure#3239 from TianoMS/tiano-d2
Change deployment polling polling logic.
2 parents a24262c + 56aac31 commit df49015

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/SdkClient/ResourceManagerSdkClient.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,20 +313,31 @@ private DeploymentExtended WaitDeploymentStatus(
313313
params ProvisioningState[] status)
314314
{
315315
DeploymentExtended deployment;
316-
int counter = 5000;
316+
317+
// Poll deployment state and deployment operations with two phases. In phase one, poll every 5 seconds. Phase one
318+
// takes 400 seconds. In phase two, poll every 60 seconds.
319+
const int counterUnit = 1000;
320+
int step = 5;
321+
int phaseOne = 400;
317322

318323
do
319324
{
320-
WriteVerbose(string.Format(ProjectResources.CheckingDeploymentStatus, counter / 1000));
321-
TestMockSupport.Delay(counter);
325+
WriteVerbose(string.Format(ProjectResources.CheckingDeploymentStatus, step));
326+
TestMockSupport.Delay(step * counterUnit);
327+
328+
if (phaseOne > 0)
329+
{
330+
phaseOne -= step;
331+
}
322332

323333
if (job != null)
324334
{
325335
job(resourceGroup, deploymentName, basicDeployment);
326336
}
327337

328338
deployment = ResourceManagementClient.Deployments.Get(resourceGroup, deploymentName);
329-
counter = counter + 5000 > 60000 ? 60000 : counter + 5000;
339+
340+
step = phaseOne > 0 ? 5 : 60;
330341

331342
} while (!status.Any(s => s.ToString().Equals(deployment.Properties.ProvisioningState, StringComparison.OrdinalIgnoreCase)));
332343

0 commit comments

Comments
 (0)