Skip to content

Commit 2202caa

Browse files
committed
feat : handle thread safe issue for getCurrentFutures
1 parent 8cc8169 commit 2202caa

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

executions/graphql-kotlin-dataloader/src/main/kotlin/com/expediagroup/graphql/dataloader/KotlinDataLoaderRegistry.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,12 @@ class KotlinDataLoaderRegistry(
6161
* @return list of current completable futures.
6262
*/
6363
fun getCurrentFutures(): List<CompletableFuture<*>> =
64-
synchronized(registry.dataLoaders) {
65-
registry.dataLoaders.map { dataLoader ->
66-
dataLoader.cacheMap.all
67-
}.flatten()
68-
}
64+
registry.dataLoaders.map { dataLoader ->
65+
synchronized(dataLoader){
66+
dataLoader.cacheMap.all.toList()
67+
}
68+
}.flatten()
69+
6970

7071
/**
7172
* This will invoke [DataLoader.dispatch] on each of the registered [DataLoader]s,

0 commit comments

Comments
 (0)