Skip to content

Commit

Permalink
fix(core): copy the list to avoid concurrent modification exception i…
Browse files Browse the repository at this point in the history
  • Loading branch information
loicmathieu committed Dec 4, 2024
1 parent fe9db94 commit 9cb1e5d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/src/test/java/io/kestra/core/runners/WorkerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,11 @@ void killed() throws InterruptedException, TimeoutException, QueueException {
executionKilledQueue.emit(ExecutionKilledExecution.builder().executionId(workerTask.getTaskRun().getExecutionId()).build());

Await.until(
() -> workerTaskResult.stream().filter(r -> r.getTaskRun().getState().isTerminated()).count() == 5,
() -> {
// copy the list to avoid concurrent modification exception if a WorkerTaskResult arrives in the queue
var copy = new ArrayList<>(workerTaskResult);
return copy.stream().filter(r -> r.getTaskRun().getState().isTerminated()).count() == 5;
},
Duration.ofMillis(100),
Duration.ofMinutes(1)
);
Expand Down

0 comments on commit 9cb1e5d

Please sign in to comment.