I am currently running into a race condition when making concurrent calls to client.Post, when the client has a custom decode configuration.
The race happen here:
Since
customDc is not nil, the
Result field is being written multiple times.
One way to deal with this would be to allow something like a "decoder factory" - a function to create a new decode config on every call instead of using the same one.
The other solution is to clone the custom decoder before writing the result.
(Another solution for me would be to use separate clients, i.e. fixing it on my side, but I think it can be nice to handle it in the library)
I'd be happy to help with the implementation if needed.
Thanks!
I am currently running into a race condition when making concurrent calls to
client.Post, when the client has a custom decode configuration.The race happen here:
gqlgen/client/client.go
Line 166 in 82bf845
Since
customDcis not nil, theResultfield is being written multiple times.One way to deal with this would be to allow something like a "decoder factory" - a function to create a new decode config on every call instead of using the same one.
The other solution is to clone the custom decoder before writing the result.
(Another solution for me would be to use separate clients, i.e. fixing it on my side, but I think it can be nice to handle it in the library)
I'd be happy to help with the implementation if needed.
Thanks!