Skip to content

Commit 12bf064

Browse files
committed
Make notifyEvent asynchronous
Signed-off-by: Robrecht Cannoodt <[email protected]>
1 parent 84e3e78 commit 12bf064

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

modules/nextflow/src/main/groovy/nextflow/Session.groovy

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package nextflow
1919
import java.nio.file.Files
2020
import java.nio.file.Path
2121
import java.nio.file.Paths
22+
import java.util.concurrent.CompletableFuture
2223
import java.util.concurrent.ConcurrentLinkedQueue
2324
import java.util.concurrent.ExecutorService
2425
import java.util.concurrent.Executors
@@ -1147,12 +1148,14 @@ class Session implements ISession {
11471148
private static <T> void notifyEvent(List<T> observers, Consumer<T> action) {
11481149
for ( int i=0; i<observers.size(); i++) {
11491150
final observer = observers.get(i)
1150-
try {
1151-
action.accept(observer)
1152-
}
1153-
catch ( Throwable e ) {
1154-
log.debug(e.getMessage(), e)
1155-
}
1151+
CompletableFuture.runAsync({
1152+
try {
1153+
action.accept(observer)
1154+
}
1155+
catch ( Throwable e ) {
1156+
log.debug(e.getMessage(), e)
1157+
}
1158+
})
11561159
}
11571160
}
11581161

0 commit comments

Comments
 (0)