Skip to content

Commit

Permalink
Merge pull request #250 from microsoft/dev +resetdemo
Browse files Browse the repository at this point in the history
restart task runner orchestration if org or proj resourcestate is not…
  • Loading branch information
markusheiliger authored Mar 25, 2021
2 parents 1f9ffdb + 2d0a307 commit 0882306
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ public async Task<ICommandResult> HandleAsync(ComponentTaskRunCommand command, I
.CallActivityWithRetryAsync<Organization>(nameof(OrganizationGetActivity), new OrganizationGetActivity.Input() { Id = commandResult.Result.Organization })
.ConfigureAwait(true);

if (organization.ResourceState != ResourceState.Succeeded)
throw new NotSupportedException($"Organization {organization} is in not supported resource state: {organization.ResourceState}");
if (!organization.ResourceState.IsFinal())
orchestrationContext.ContinueAsNew(command, false);
else if (organization.ResourceState == ResourceState.Failed)
throw new NotSupportedException("Can't process task when organization resource state is 'Failed'");
}

var project = await orchestrationContext
Expand All @@ -70,8 +72,10 @@ public async Task<ICommandResult> HandleAsync(ComponentTaskRunCommand command, I
.CallActivityWithRetryAsync<Project>(nameof(ProjectGetActivity), new ProjectGetActivity.Input() { Organization = commandResult.Result.Organization, Id = commandResult.Result.ProjectId })
.ConfigureAwait(true);

if (project.ResourceState != ResourceState.Succeeded)
throw new NotSupportedException($"Project {project} is in not supported resource state: {project.ResourceState}");
if (!project.ResourceState.IsFinal())
orchestrationContext.ContinueAsNew(command, false);
else if (project.ResourceState == ResourceState.Failed)
throw new NotSupportedException("Can't process task when project resource state is 'Failed'");
}

var component = await orchestrationContext
Expand Down

0 comments on commit 0882306

Please sign in to comment.