Skip to content

Commit 194328a

Browse files
feat : handle thread safe issue for getCurrentFutures(#1843) (#1844)
cherry pick #1843
1 parent 13c91fb commit 194328a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ 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()
6969

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

0 commit comments

Comments
 (0)