graphql-go-tools
graphql-go-tools copied to clipboard
Pools appear to be singletons
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?
No real reason. You're making good points. Happy to get PRs to improve it.