public IEnumerable NextNode()

in src/Elastic.Transport/Components/Pipeline/RequestPipeline.cs [356:390]


	public IEnumerable<Node> NextNode(DateTimeOffset startedOn, int attemptedNodes, Auditor? auditor)
	{
		if (_boundConfiguration.ForceNode != null)
		{
			yield return new Node(_boundConfiguration.ForceNode);
			yield break;
		}

		//This for loop allows to break out of the view state machine if we need to
		//force a refresh (after reseeding node pool). We have a hardcoded limit of only
		//allowing 100 of these refreshes per call
		var refreshed = false;
		for (var i = 0; i < 100; i++)
		{
			if (DepletedRetries(startedOn, attemptedNodes)) yield break;

			foreach (var node in _nodePool.CreateView(auditor))
			{
				if (DepletedRetries(startedOn, attemptedNodes)) break;

				if (!_nodePredicate(node)) continue;

				yield return node;

				if (!Refresh) continue;

				Refresh = false;
				refreshed = true;
				break;
			}
			//unless a refresh was requested we will not iterate over more then a single view.
			//keep in mind refreshes are also still bound to overall maxretry count/timeout.
			if (!refreshed) break;
		}
	}