Skip to content

Commit

Permalink
fix reuse do not exit bug
Browse files Browse the repository at this point in the history
  • Loading branch information
peacewong committed Jul 26, 2023
1 parent 049038a commit cdba63a
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ public EngineNode reuseEngine(EngineReuseRequest engineReuseRequest, Sender send
EngineNode[] engineScoreList = getEngineNodeManager().getEngineNodes(scoreServiceInstances);

List<EngineNode> engines = Lists.newArrayList();
int count = 1;
long timeout =
engineReuseRequest.getTimeOut() <= 0
? AMConfiguration.ENGINE_REUSE_MAX_TIME.getValue().toLong()
Expand All @@ -177,8 +176,9 @@ public EngineNode reuseEngine(EngineReuseRequest engineReuseRequest, Sender send

long startTime = System.currentTimeMillis();
try {
MutablePair<Integer, Integer> limitPair = MutablePair.of(1, reuseLimit);
LinkisUtils.waitUntil(
() -> selectEngineToReuse(MutablePair.of(count, reuseLimit), engines, engineScoreList),
() -> selectEngineToReuse(limitPair, engines, engineScoreList),
Duration.ofMillis(timeout));
} catch (TimeoutException e) {
throw new LinkisRetryException(
Expand Down Expand Up @@ -226,6 +226,7 @@ public boolean selectEngineToReuse(
AMConstant.ENGINE_ERROR_CODE,
"Engine reuse exceeds limit: " + count2reuseLimit.getRight());
}
count2reuseLimit.setLeft(count2reuseLimit.getLeft() + 1);
Optional<Node> choseNode = nodeSelector.choseNode(engineScoreList);
if (!choseNode.isPresent()) {
throw new LinkisRetryException(AMConstant.ENGINE_ERROR_CODE, "No engine can be reused");
Expand Down

0 comments on commit cdba63a

Please sign in to comment.