Skip to content

Commit

Permalink
Fix leadership spinning
Browse files Browse the repository at this point in the history
  • Loading branch information
Drawaes committed Mar 21, 2019
1 parent 576d317 commit 2e62ddc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
7 changes: 7 additions & 0 deletions releasenotes/4.1.6.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project>
<PropertyGroup>
<PackageReleaseNotes>
* Fix spinning on leadership election
</PackageReleaseNotes>
</PropertyGroup>
</Project>
4 changes: 3 additions & 1 deletion src/CondenserDotNet.Client/Leadership/LeaderWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private async Task TryForElection()
_electedLeaderEvent.Reset();
_currentLeaderEvent.Reset();
CondenserEventSource.Log.LeadershipTryToLock(_keyToWatch);
var leaderResult = await _serviceManager.Client.PutAsync($"{KeyPath}{_keyToWatch}?acquire={_sessionId}", GetServiceInformation());
var leaderResult = await _serviceManager.Client.PutAsync($"{KeyPath}{_keyToWatch}?acquire={_sessionId}&index={_consulIndex}", GetServiceInformation());
if (!leaderResult.IsSuccessStatusCode)
{
//error so we need to get a new session
Expand All @@ -72,6 +72,8 @@ private async Task TryForElection()
leaderResult = await _serviceManager.Client.GetAsync($"{KeyPath}{_keyToWatch}?index={_consulIndex}");
if (!leaderResult.IsSuccessStatusCode)
{
_currentLeaderEvent.Reset();
_electedLeaderEvent.Reset();
//error so return to create session
return;
}
Expand Down
2 changes: 1 addition & 1 deletion version.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<VersionPrefix>4.1.5</VersionPrefix>
<VersionPrefix>4.1.6</VersionPrefix>
<VersionSuffix>beta</VersionSuffix>
</PropertyGroup>
</Project>

0 comments on commit 2e62ddc

Please sign in to comment.