You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rewrite CompletableFutureExtension.allSettled to not use CompletableFuture.supplyAsync (#1872)
We noticed a big drop in performance after switching to the new
`CompletableFuture` based `FederatedTypeResolver`. Our investigations
led us to the implementation of `CompletableFutureExtension.allSettled`
which has the following issues:
- Bug: It uses `CompletableFuture.supplyAsync` which looses all thread
local data (as we switch to another thread pool we have no control
over), which breaks most tracing frameworks and all other thread local
usages
- Performance: 100 futures get wrapped into 100 separately scheduled
futures, this is unnecessary as `thenApply` and `exceptionally` work
without nesting of futures. This avoids non-neglegible overhead
I changed the accompanying test to expect another exception type as only
`get()` throw a `ExecutionException`. This should not affect your public
API as its an internal method and I could not find any other references
to `ExecutionException` in `graphql-kotlin`s codebase.
Co-authored-by: Heller, Nico [CBC] <[email protected]>
Copy file name to clipboardExpand all lines: generator/graphql-kotlin-federation/src/main/kotlin/com/expediagroup/graphql/generator/federation/extensions/CompletableFutureExtensions.kt
Copy file name to clipboardExpand all lines: generator/graphql-kotlin-federation/src/test/kotlin/com/expediagroup/graphql/generator/federation/extensions/CompletableFutureExtensionsKtTest.kt
0 commit comments