Fork me on GitHub
#graphql
<
2019-08-26
>
promesante08:08:36

The Fullstack Tutorial for GraphQL, https://www.howtographql.com/, ported from Javascript to Clojure/script: Blog post: https://promesante.github.io/2019/08/14/clojure_graphql_fullstack_learning_project_part_1.html Source code GitHub repo: https://github.com/promesante/hn-clj-pedestal-re-frame Suggestions and corrections, more than welcome. Hope it to be useful for anyone interested.

steveb8n09:08:40

Q: I want to use lacinia-pedestal to use a non-blocking micro-service call in a resolver. I’ve looked at the tests for async but I’m wondering if there’s any other samples out there of implementing resolvers this way?

steveb8n00:08:57

@UDF11HLKC yes that is close however I believe the resolvers in a lacinia-pedestal environment might be slightly different from vanilla Lacinia. The reason I suspect this is that Pedestal runs async when an interceptor returns a core.async channel so I’m not clear on the right way to implement. I’ll keep digging but thanks for your response.

hlship16:08:20

Lacinia-pedestal can run in two modes; there's an option for that. In mode 1, it blocks while query executes; individual resolvers may be sync or async. This will result in a Jetty request thread being blocked. In mode 2, it returns a channel while the query executes async. Resolvers may be async or not.

hlship16:08:01

There's also a thead pool you can optionally specify (so that you don't accidentally do lots of work and/or block a go thread).