graphql-go-tools icon indicating copy to clipboard operation
graphql-go-tools copied to clipboard

Pools appear to be singletons

Open schmidtw opened this issue 2 years ago • 1 comments

I noticed when I was digging though the batch code that the pools appear to be singletons. (Where I noticed this: https://github.com/wundergraph/graphql-go-tools/blob/e6e1a13e36eaf3a4e09a2bbd1eca3dfcb3d955d6/pkg/engine/datasource/graphql_datasource/batch.go#L45)

Here are the 3 different pools & the global singleton variables: https://github.com/wundergraph/graphql-go-tools/blob/e6e1a13e36eaf3a4e09a2bbd1eca3dfcb3d955d6/pkg/pool/bytesbuffer.go#L9 https://github.com/wundergraph/graphql-go-tools/blob/e6e1a13e36eaf3a4e09a2bbd1eca3dfcb3d955d6/pkg/pool/fastbuffer.go#L9 https://github.com/wundergraph/graphql-go-tools/blob/e6e1a13e36eaf3a4e09a2bbd1eca3dfcb3d955d6/pkg/pool/hash64.go#L11

Generally this pattern is not ideal - is there a reason we can't / shouldn't be able to provide these during engine invocation?

schmidtw avatar Jul 25 '22 21:07 schmidtw

No real reason. You're making good points. Happy to get PRs to improve it.

jensneuse avatar Jul 26 '22 05:07 jensneuse