Skip to content

Commit

Permalink
[fix][chat] Fix the issue with the order of parallel execution in the…
Browse files Browse the repository at this point in the history
… map. (#1976)
  • Loading branch information
lexluo09 authored Dec 25, 2024
1 parent 6738aba commit c483bb8
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public abstract class BaseMatchStrategy<T extends MapResult> implements MatchStr

@Override
public Map<MatchText, List<T>> match(ChatQueryContext chatQueryContext, List<S2Term> terms,
Set<Long> detectDataSetIds) {
Set<Long> detectDataSetIds) {
String text = chatQueryContext.getRequest().getQueryText();
if (Objects.isNull(terms) || StringUtils.isEmpty(text)) {
return null;
Expand All @@ -43,7 +43,7 @@ public Map<MatchText, List<T>> match(ChatQueryContext chatQueryContext, List<S2T
}

public List<T> detect(ChatQueryContext chatQueryContext, List<S2Term> terms,
Set<Long> detectDataSetIds) {
Set<Long> detectDataSetIds) {
throw new RuntimeException("Not implemented");
}

Expand Down Expand Up @@ -73,11 +73,15 @@ public void selectResultInOneRound(Set<T> existResults, List<T> oneRoundResults)
protected void executeTasks(List<Callable<Void>> tasks) {
try {
threadPoolConfig.getMapExecutor().invokeAll(tasks);
} catch (InterruptedException e) {
for (Callable<Void> future : tasks) {
future.call();
}
} catch (Exception e) {
Thread.currentThread().interrupt();
throw new RuntimeException("Task execution interrupted", e);
}
}

public double getThreshold(Double threshold, Double minThreshold, MapModeEnum mapModeEnum) {
if (MapModeEnum.STRICT.equals(mapModeEnum)) {
return 1.0d;
Expand Down

0 comments on commit c483bb8

Please sign in to comment.