Skip to content

Commit

Permalink
fix(raft): do not handle response if the role is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
deepthidevaki committed Oct 10, 2022
1 parent 80a39d4 commit 11a58e4
Showing 1 changed file with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,16 +208,16 @@ private void sendAppendRequest(final RaftMemberContext member, final AppendReque
.append(member.getMember().memberId(), request)
.whenCompleteAsync(
(response, error) -> {
// Complete the append to the member.
final long appendLatency = System.currentTimeMillis() - timestamp;
metrics.appendComplete(appendLatency, member.getMember().memberId().id());
if (!request.entries().isEmpty()) {
member.completeAppend(appendLatency);
} else {
member.completeAppend();
}

if (open) {
// Complete the append to the member.
final long appendLatency = System.currentTimeMillis() - timestamp;
metrics.appendComplete(appendLatency, member.getMember().memberId().id());
if (!request.entries().isEmpty()) {
member.completeAppend(appendLatency);
} else {
member.completeAppend();
}

if (error == null) {
log.trace("Received {} from {}", response, member.getMember().memberId());
handleAppendResponse(member, request, response, timestamp);
Expand Down Expand Up @@ -300,10 +300,10 @@ private void sendConfigureRequest(
.configure(member.getMember().memberId(), request)
.whenCompleteAsync(
(response, error) -> {
// Complete the configure to the member.
member.completeConfigure();

if (open) {
// Complete the configure to the member.
member.completeConfigure();

if (error == null) {
log.trace("Received {} from {}", response, member.getMember().memberId());
handleConfigureResponse(member, request, response, timestamp);
Expand Down Expand Up @@ -413,10 +413,10 @@ private void sendInstallRequest(final RaftMemberContext member, final InstallReq
.install(member.getMember().memberId(), request)
.whenCompleteAsync(
(response, error) -> {
// Complete the install to the member.
member.completeInstall();

if (open) {
// Complete the install to the member.
member.completeInstall();

if (error == null) {
log.trace("Received {} from {}", response, member.getMember().memberId());
handleInstallResponse(member, request, response, timestamp);
Expand Down

0 comments on commit 11a58e4

Please sign in to comment.