Comments (2)
We've wanted to have dataloader-like capabilities for some time, but it is dependent on having full concurrency support in the code base (which currently needs some timeout handling code). Indeed, once that is in, the plan is to have a hook-like functionality where you can register a small function to be run (usually you will use it to send a message).
The concurrency-work is not documented yet, mostly because it is highly experimental and still subject to change. But indeed, the defer_loop
function is the place where you want some kind of hook in order to tick and tell a data loader process to execute its batch of work.
from graphql-erlang.
We may need this feature soon because certain nested queries with shared nodes are performing terribly.
The batch start hook should be in Ctx
just like error_mod
. For extensibility, I think it should be a module just like error. The key can be something like concurrency_mod
or batch_mod
.
hook:begin_loop(Ctx)
should kick the data loader process and defer_hook:end_loop(Ctx)
can do some clean up if necessary.
For actual implementation, I'm not sure what's the right thing to do. Here's what I have in mind.
Wrap this call: https://github.com/shopgun/graphql-erlang/blob/8e75a73892a97f43e142fabf04599acebea8eb95/src/graphql_execute.erl#L105
with Hook:begin_loop(Ctx)
and Hook:end_loop(Ctx)
. Maybe a with a try finally
to ensure end_loop
is always called.
I'm not sure how error in begin_loop
and end_loop
should be handled, probably just like resolver_crash
.
Any inputs on this?
from graphql-erlang.
Related Issues (20)
- Jun2018 clarify: Improve the Input Object input coercion subsection with more examples (#388) HOT 1
- Jun2018 clarify: Generalize validation of value literals, changing the names of validation rules but not changing the validity of documents (#389) HOT 1
- Jun2018 clarify: Fix ExecuteSelectionSet algorithm where fieldType may not be defined, but will never be null (#433) HOT 1
- Jun2018 clarify: Make it clear that field result coercion should throw errors before data loss (#434) HOT 2
- Jun2018 clarify: Clarify list coercion rules, especially with respect to null values, including examples (#436, #440) HOT 1
- Move this project to Erlang 21.x
- Jun2018 Spec: Null value support (2.9.5) HOT 2
- Jun2018 spec: Handle type extensions HOT 1
- Jun 2018 spec: Handle the new Schema definition HOT 5
- Replace scalar `input/2` and `output/2` with a `scalar/3` function HOT 2
- Add support for a @deprecated directive
- Errornous handling of nulls in inlined field arguments HOT 2
- Translate GraphQL qureries to SQL HOT 2
- Questions about graphql:sync/3 HOT 1
- Handle application failure of graphql:map/2
- bug in graphql:type_check_params/3? HOT 2
- GraphQL with Yaws HOT 1
- Failing Hex package compilation HOT 6
- GraphQL parsing fails on 'subscription' field
- Introspection produces `Bool` instead of `Boolean`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-erlang.