public async Task <IEnumerable <NodeInfo> > GetLatestNodeInfoAsync(TimeSpan requestTimeout, TimeSpan operationTimeout, CancellationToken cancellationToken) { // Get all current known nodes NodeList nodeList = new NodeList(); string continuationToken = null; do { NodeList queryResult = await FabricClientRetryHelper.ExecuteFabricActionWithRetryAsync( () => this.fabricClient.QueryManager.GetNodeListAsync(null, continuationToken), operationTimeout, cancellationToken).ConfigureAwait(false); nodeList.AddRangeNullSafe(queryResult); continuationToken = queryResult.ContinuationToken; } while (!string.IsNullOrEmpty(continuationToken)); if (nodeList.Count == 0) { throw new InvalidOperationException(StringHelper.Format(StringResources.Error_NotEnoughNodesForTestabilityAction, "GetNodes")); } var nodes = new List <NodeInfo>(); foreach (Node node in nodeList) { NodeInfo nodeInfo = NodeInfo.CreateNodeInfo(node); nodes.Add(nodeInfo); } return(nodes); }
public async Task <NodeList> GetNodeListAsync(TimeSpan timeout, CancellationToken token) { Trace.WriteInfo(TraceType, "Calling GetNodeList. Timeout: {0}", timeout); NodeList aggregatedNodeList = new NodeList(); string continuationToken = null; do { var nodeList = await this.fabricClient.QueryManager.GetNodeListAsync(null, NodeStatusFilter.All, continuationToken, timeout, token); aggregatedNodeList.AddRangeNullSafe(nodeList); continuationToken = nodeList.ContinuationToken; }while(!string.IsNullOrEmpty(continuationToken)); return(aggregatedNodeList); }