Skip to content

Change deployment polling polling logic. #3239

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 2, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -313,20 +313,31 @@ private DeploymentExtended WaitDeploymentStatus(
params ProvisioningState[] status)
{
DeploymentExtended deployment;
int counter = 5000;

// Poll deployment state and deployment operations with two phases. In phase one, poll every 5 seconds. Phase one
// takes 400 seconds. In phase two, poll every 60 seconds.
const int counterUnit = 1000;
int step = 5;
int phaseOne = 400;

do
{
WriteVerbose(string.Format(ProjectResources.CheckingDeploymentStatus, counter / 1000));
TestMockSupport.Delay(counter);
WriteVerbose(string.Format(ProjectResources.CheckingDeploymentStatus, step));
TestMockSupport.Delay(step * counterUnit);

if (phaseOne > 0)
{
phaseOne -= step;
}

if (job != null)
{
job(resourceGroup, deploymentName, basicDeployment);
}

deployment = ResourceManagementClient.Deployments.Get(resourceGroup, deploymentName);
counter = counter + 5000 > 60000 ? 60000 : counter + 5000;

step = phaseOne > 0 ? 5 : 60;

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

Expand Down