in src/PatchOrchestrationApplication/NodeAgentNTService/src/Utility/NodeAgentSfUtility.cs [208:253]
public bool GetApplicationDeployedStatus(TimeSpan timeout)
{
_eventSource.InfoMessage("Getting Application deployed status for application : {0}", this._applicationUri.ToString());
string[] arguments = { "GetApplicationDeployedStatus", this._applicationUri.ToString(), timeout.TotalSeconds.ToString() };
ProcessExecutor processExecutor = new ProcessExecutor(SfUtilityFileName, CreateProcessArgument(arguments));
long retries = 0;
while (!this._cancellationToken.IsCancellationRequested)
{
int exitCode = processExecutor.Execute();
if (exitCode == (int)NodeAgentSfUtilityExitCodes.Success)
{
return true;
}
if (exitCode == (int)NodeAgentSfUtilityExitCodes.ApplicationNotFound)
{
return false;
}
if (exitCode == (int)NodeAgentSfUtilityExitCodes.DllNotFoundException)
{
// RDBUG 9845931 - For a rare case Fabric.Code path might not be set by SF yet.
// Best course of action in that situation is to refresh the environment variables once fabric comes up, hence restart this service once SF has come up.
StringBuilder stringBuilder = new StringBuilder("Exiting the service to fetch new environment variables. Current environment variables are : ");
foreach (DictionaryEntry envVariable in Environment.GetEnvironmentVariables())
{
stringBuilder.AppendFormat("{0}={1} , ", envVariable.Key, envVariable.Value);
}
_eventSource.WarningMessage(stringBuilder.ToString());
// Wait for 5 seconds before exit
Task.Delay(5000).Wait();
Environment.Exit(10);
}
if (retries >= this._serviceSettings.WUOperationRetryCount || this._cancellationToken.IsCancellationRequested)
{
break;
}
TimeSpan retryDelayTime = TimeSpan.FromMinutes(this._serviceSettings.WUDelayBetweenRetriesInMinutes);
this._helper.WaitOnTask(Task.Delay(retryDelayTime), this._cancellationToken);
retries++;
}
throw new Exception("Not able to get application status.");
}