Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable batch execution #1965

Merged
merged 1 commit into from
Aug 31, 2020
Merged

enable batch execution #1965

merged 1 commit into from
Aug 31, 2020

Conversation

yaacovCR
Copy link
Collaborator

@yaacovCR yaacovCR commented Aug 30, 2020

WIP:

When batch is set to true for a given subschemaConfig, batches all delegated root fields into a combined request passed to the executor. Moreover, batches all requests to a given subschema into the minimum number of requests, collecting queries and mutations separately, preserving operation order. Distributes properly pathed errors to the originating requests.

Adapted from Gatsby query batcher by @vladar.

Caveats:

  • Uses a Dataloader under the hood, which is created anew upon each request -- relies on a unique context argument per request to make this happen!
  • Does not pass info argument to the batched executor call, disabling any executors that used extensions annotated onto info.

TODO:

  • Add testing!
  • Extensions support should be added by a custom option?

Related:

gatsbyjs/gatsby#22347 (comment)
#1710 (comment)
#1959 (comment)
#1954

@yaacovCR yaacovCR merged commit 0bc10c4 into v7 Aug 31, 2020
@yaacovCR yaacovCR deleted the batch-execution branch August 31, 2020 04:50
yaacovCR added a commit that referenced this pull request Aug 31, 2020
WIP:

When `batch` is set to true for a given subschemaConfig, batches all delegated root fields into a combined request passed to the executor. Moreover, batches all requests to a given subschema into the minimum number of requests, collecting queries and mutations separately, preserving operation order. Distributes properly pathed errors to the originating requests.

Adapted from Gatsby query batcher by @vladar.

Caveats:
* Uses a Dataloader under the hood, which is created anew upon each request -- relies on a unique context argument per request to make this happen!
* Does not pass `info` argument to the batched executor call, disabling any executors that used extensions annotated onto info.

TODO:
- Add testing!
- Extensions support should be added by a custom option?

Related:

gatsbyjs/gatsby#22347 (comment)
#1710 (comment)
#1959 (comment)
#1954
This was referenced Aug 31, 2020
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant