private async Task PollStatusUntilDone()

in Editor/CoreAPI/DeploymentWaiter.cs [100:145]


        private async Task<DeploymentResponse> PollStatusUntilDone(DeploymentId deploymentId)
        {
            var poller = new UntilResponseFailurePoller(_delay);

            DescribeStackResponse describeStackResponse = await poller.Poll(StackPollPeriodMs,
                () =>
                {
                    DescribeStackResponse response = GameLiftCoreApi.DescribeStack(deploymentId.Profile, deploymentId.Region, deploymentId.StackName);

                    if (!response.Success)
                    {
                        return response;
                    }

                    if (_currentToken == null
                        && (response.StackStatus == StackStatus.UpdateInProgress || response.StackStatus == StackStatus.CreateInProgress))
                    {
                        CanCancel = true;
                        _currentToken = Guid.NewGuid().ToString();
                        _isCreating = response.StackStatus == StackStatus.CreateInProgress;
                    }

                    InfoUpdated?.Invoke(new DeploymentInfo(deploymentId, response, deploymentId.ScenarioName));
                    return response;
                },
                stopCondition: target => !_isWaiting || target.StackStatus.IsStackStatusOperationDone());

            if (!describeStackResponse.Success)
            {
                return Response.Fail(new DeploymentResponse(describeStackResponse));
            }

            if (!_isWaiting)
            {
                return Response.Fail(new DeploymentResponse(ErrorCode.OperationCancelled));
            }

            if (describeStackResponse.StackStatus != StackStatus.CreateComplete
                && describeStackResponse.StackStatus != StackStatus.UpdateComplete
                && describeStackResponse.StackStatus != StackStatus.UpdateCompleteCleanUpInProgress)
            {
                return Response.Fail(new DeploymentResponse(ErrorCode.StackStatusInvalid, $"The '{deploymentId.StackName}' stack status is {describeStackResponse.StackStatus}"));
            }

            return Response.Ok(new DeploymentResponse(_currentRequest));
        }