Skip to content

Commit 6cfa023

Browse files
committed
Disable the ordered execution of blocking actions (specifically tools) as it causes a deadlock when the tool itself also requires running on the vertx contex
Use unordered executeBlocking only on tool calling
1 parent d2ef574 commit 6cfa023

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

core/runtime/src/main/java/io/quarkiverse/langchain4j/runtime/aiservice/QuarkusAiServiceStreamingResponseHandler.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,29 +141,29 @@ public void run() {
141141

142142
private void executeTools(Runnable runnable) {
143143
if (mustSwitchToWorkerThread && Context.isOnEventLoopThread()) {
144-
executeOnWorkerThread(runnable);
144+
executeOnWorkerThread(runnable, false);
145145
} else {
146146
runnable.run();
147147
}
148148
}
149149

150150
private void execute(Runnable runnable) {
151151
if (switchToWorkerForEmission && Context.isOnEventLoopThread()) {
152-
executeOnWorkerThread(runnable);
152+
executeOnWorkerThread(runnable, true);
153153
} else {
154154
runnable.run();
155155
}
156156
}
157157

158-
private void executeOnWorkerThread(Runnable runnable) {
158+
private void executeOnWorkerThread(Runnable runnable, boolean ordered) {
159159
if (executionContext != null) {
160160
executionContext.executeBlocking(new Callable<Object>() {
161161
@Override
162162
public Object call() throws Exception {
163163
runnable.run();
164164
return null;
165165
}
166-
}, true);
166+
}, ordered);
167167
} else {
168168
executor.submit(runnable);
169169
}

0 commit comments

Comments
 (0)