I use graphql-kotlin on top of Ktor. I have a situ...
# graphql-kotlin
r
I use graphql-kotlin on top of Ktor. I have a situation in which I get occasional random and not easily reproducible network errors (
IOException: Broken pipe
) from my db driver. While I continue to investigate the root cause of this, I'd like to add a workaround with some retry logic. Since the underlying exception could occur pretty much anywhere, I'm thinking having the logic at the graphql-kotlin layer makes sense, if it is possible. What would the right way to do this? Would an interceptor work for this case?
In some cases, the error happens at the field level, and the
defaultDataFetcherExceptionHandler
is invoked for the entire message. Would be nice to be able to retry the fetch for just the field that failed, but I'd settle for retrying the entire thing.
d
GraphQL engine is unaware of your fetch logic (you can pull the data from whatever sources) so I personally wouldn't try to modify graphql layer. IMHO you should retry your DB calls instead.
r
Yeah that's what I ended up doing. Thanks!
a
You can wrap your fetching with something like https://stackoverflow.com/a/46890009