in GameLiftPlugin/Source/GameLiftPlugin/Private/SMenu/Containers/SCreateContainerGroupSection.cpp [392:474]
void SCreateContainerGroupSection::PollDescribeContainerGroupDefinition()
{
Async(EAsyncExecution::Thread,
[this]() mutable
{
UGameLiftContainersStatus* ContainersStatus = GetMutableDefault<UGameLiftContainersStatus>();
int i = 0;
GameLiftDescribeCgdResult DescribeCGDResult;
bool HasSucceeded = false;
// Setting a 2 hour timeout for pulling cfn deployment result
for (; i < WaitTimesCount; ++i) {
FPlatformProcess::Sleep(WaitIntervalSeconds);
// First detect the stack deployment status
if (EDeploymentMessageStateFromString(ContainersStatus->Status.ToString()) == EDeploymentMessageState::FailureMessage) {
Async(EAsyncExecution::TaskGraphMainThread,
[this, HasSucceeded]() mutable
{
// Manually update status to FAILED if stack has failed and we previously succeeded
// ie. Stack may have deleted CGD successfully before we detected CGD failure
if (HasSucceeded)
{
UpdateCgdStatusTextBlock(Menu::DeployContainers::kFailed);
}
});
break;
}
// Describe the CGD
IGameLiftContainersHandler& Handler = IGameLiftCoreModule::Get().GetGameLiftContainersHandler();
DescribeCGDResult = Handler.DescribeCgd(ContainersStatus->CgdName);
if (DescribeCGDResult.bIsSuccessful) {
HasSucceeded = true;
Async(EAsyncExecution::TaskGraphMainThread,
[this, DescribeCGDResult]() mutable
{
UGameLiftContainersStatus* ContainersStatus = GetMutableDefault<UGameLiftContainersStatus>();
UpdateCgdStatusTextBlock(FText::FromString(DescribeCGDResult.CgdStatus));
GroupDefinitionNameTextBlock->SetText(FText::FromString(ContainersStatus->CgdName));
CgdVersionTextBlock->SetText(FText::FromString(DescribeCGDResult.CgdVersion));
ContainersStatus->CgdVersion = DescribeCGDResult.CgdVersion;
ContainersStatus->CgdStatus = DescribeCGDResult.CgdStatus;
ContainersStatus->SaveConfig();
});
if (DescribeCGDResult.CgdStatus.Equals("READY")) {
Async(EAsyncExecution::TaskGraphMainThread,
[this]()
{
HandleCgdReady();
});
break;
}
else if (DescribeCGDResult.CgdStatus == "FAILED") {
HandleCgdFailed();
break;
}
}
}
if (i == WaitTimesCount) {
bool success = DescribeCGDResult.bIsSuccessful;
FString ErrorMessage = DescribeCGDResult.ErrorMessage;
Async(EAsyncExecution::TaskGraphMainThread,
[this, success = MoveTemp(success), ErrorMessage = MoveTemp(ErrorMessage)]() mutable
{
UGameLiftContainersStatus* ContainersStatus = GetMutableDefault<UGameLiftContainersStatus>();
ProgressBar->ChangeProgressBarUIState(SProgressBar::EProgressBarUIState::ProgressError);
ContainersStatus->ErrorCreatingContainerGroupSection = true;
ContainersStatus->IsCgdConfigurationFinished = false;
ErrorTextBlock->SetText(Menu::DeployContainers::kTimedOutPollingCgdStatusErrorMessage);
ContainersStatus->ErrorMessageCreatingContainerImage = Menu::DeployContainers::kTimedOutPollingCgdStatusErrorMessage;
if (!success) {
UE_LOG(GameLiftPluginLog, Display, TEXT("Timed out describing container group definition, %s"), *ErrorMessage);
}
else {
UE_LOG(GameLiftPluginLog, Display, TEXT("Timed out waiting for container group definition to enter READY or FAILED status"));
}
ContainersStatus->SaveConfig();
});
}
ContainersStatus->SaveConfig();
});
}