Skip to content

Commit

Permalink
correctly handle StatusRuntimeException
Browse files Browse the repository at this point in the history
  • Loading branch information
Hellblazer committed Oct 23, 2023
1 parent d225253 commit 5dc7fa9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.salesforce.apollo.membership.Ring.IterateResult;
import com.salesforce.apollo.membership.SigningMember;
import com.salesforce.apollo.utils.Entropy;
import io.grpc.StatusRuntimeException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -153,7 +154,12 @@ private <Q> void execute(BiFunction<Comm, Integer, Q> round, SyncHandler<T, Q, C
if (destination.link == null) {
handler.handle(Optional.empty(), destination);
} else {
var result = round.apply(destination.link, destination.ring);
Q result = null;
try {
result = round.apply(destination.link, destination.ring);
} catch (StatusRuntimeException e) {
log.trace("error applying round to: %s", destination.member.getId(), e);
}
handler.handle(Optional.ofNullable(result), destination);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.salesforce.apollo.membership.SigningMember;
import com.salesforce.apollo.utils.Entropy;
import com.salesforce.apollo.utils.Utils;
import io.grpc.StatusRuntimeException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -75,7 +76,12 @@ private <T> void internalIterate(BiFunction<Comm, Member, T> round,
}
log.trace("Iteration on: {} index: {} to: {} on: {}", label, current.getId(), link.getMember(),
member.getId());
var result = round.apply(link, link.getMember());
T result = null;
try {
result = round.apply(link, link.getMember());
} catch (StatusRuntimeException e) {
log.trace("Error applying round", e);
}
allowed.accept(handler.handle(Optional.ofNullable(result), link, link.getMember()));
} catch (IOException e) {
log.debug("Error closing", e);
Expand Down

0 comments on commit 5dc7fa9

Please sign in to comment.