Skip to content

Commit 1bbd12a

Browse files
committed
Reset the global cursor when successful node exists
#1810
1 parent 0a5251b commit 1bbd12a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Elasticsearch.Net/ConnectionPool/StickyConnectionPool.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ public IEnumerable<Node> CreateView(Action<AuditEvent, Node> audit = null)
7070
yield break;
7171
}
7272

73+
// If the cursor is greater than the default then it's been
74+
// set already but we now have a live node so we should reset it
75+
if (GlobalCursor > -1)
76+
{
77+
Interlocked.Exchange(ref GlobalCursor, -1);
78+
}
79+
7380
var localCursor = 0;
7481

7582
for (var attempts = 0; attempts < count; attempts++)

0 commit comments

Comments
 (0)