in src/PatchOrchestrationApplication/NodeAgentNTService/src/Manager/WindowsUpdateManager.cs [764:801]
private OperationResultCode SearchUpdates(CancellationToken cancellationToken)
{
_eventSource.InfoMessage("Search Started.");
if (cancellationToken.IsCancellationRequested)
{
_eventSource.InfoMessage("Search Aborted.");
return OperationResultCode.orcAborted;
}
ISearchResult searchResult = null;
long retries = 0;
while (!cancellationToken.IsCancellationRequested)
{
searchResult = SearchUpdatesUtil(cancellationToken);
if ((searchResult != null && searchResult.ResultCode == OperationResultCode.orcSucceeded) || retries >= this._serviceSettings.WUOperationRetryCount || cancellationToken.IsCancellationRequested)
{
break;
}
TimeSpan delayBetweenRetries = TimeSpan.FromMinutes(this._serviceSettings.WUDelayBetweenRetriesInMinutes);
this._helper.WaitOnTask(Task.Delay(delayBetweenRetries), cancellationToken);
retries++;
}
if (searchResult != null)
{
this._wuCollectionWrapper = this.GetWUCollection(searchResult.Updates);
_eventSource.Message("Search finished with result : {0}. Total searched results : {1}", searchResult.ResultCode, this._wuCollectionWrapper.Collection.Count);
return searchResult.ResultCode;
}
else
{
this._wuCollectionWrapper = null;
_eventSource.Message("No Search Result!");
return OperationResultCode.orcFailed;
}
}