Fix bad logic in MaxMind circuit breaker processor (no clue what I was thinking when I first wrote it)
This commit is contained in:
parent
831348b4f8
commit
2f60ce2aa7
@ -50,15 +50,22 @@ public class MaxMindUtils {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
MaxMindResult maxMindResult = new MaxMindResult(bodyJson);
|
MaxMindResult maxMindResult = new MaxMindResult(bodyJson);
|
||||||
future.complete(maxMindResult);
|
|
||||||
|
// we have to check !isComplete() because the circuit breaker's timeout might mark us as failed already
|
||||||
|
if (!future.isComplete()) {
|
||||||
|
future.complete(maxMindResult);
|
||||||
|
}
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
future.complete(null);
|
// we have to check !isComplete() because the circuit breaker's timeout might mark us as failed already
|
||||||
|
if (!future.isComplete()) {
|
||||||
|
future.complete(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
response.exceptionHandler((error) -> {
|
response.exceptionHandler((error) -> {
|
||||||
// we have to check !failed because the circuit breaker's timeout will mark us as failed already
|
// we have to check !isComplete() because the circuit breaker's timeout will might us as failed already
|
||||||
if (future.isComplete()) {
|
if (!future.isComplete()) {
|
||||||
future.fail(error);
|
future.fail(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user