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

GraphQL queries running in parallel and in their own context #30

Open
joelgriffith opened this Issue Jul 19, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@joelgriffith
Owner

joelgriffith commented Jul 19, 2017

Really like this idea. Some thoughts I have:

  • No clear way to "clone" a tab in Chrome...
  • Would probably need to have some limitation on the amount of parallelism in requests.
  • Technically might be challenging to orchestrate all of it due to the async nature of the API and how all of these pieces interact.
@mute

This comment has been minimized.

Show comment
Hide comment
@mute

mute Jul 19, 2017

Collaborator

Totally agreed with those concerns -- here's my hand wavy explanation of how I think this might be possible, but it's hand wavy because I'm not a GraphQL guru:

  1. Parse GraphQL query into an array of Promise chains which resolve to the sequence of actual navalia / chrome API functions. This should result in n Promises where n is the number of leaf nodes in the query.
  2. For each of these Promises, spawn a tab up to whatever the maximum specified number of tabs is.
  3. Resolve each promise chain in its corresponding tab.
  4. Continue until tabs have been spawned / resolved for each leaf node.

So, we shouldn't need to clone tabs, each tab will just execute the same series of steps in parallel up until the query branches.

Collaborator

mute commented Jul 19, 2017

Totally agreed with those concerns -- here's my hand wavy explanation of how I think this might be possible, but it's hand wavy because I'm not a GraphQL guru:

  1. Parse GraphQL query into an array of Promise chains which resolve to the sequence of actual navalia / chrome API functions. This should result in n Promises where n is the number of leaf nodes in the query.
  2. For each of these Promises, spawn a tab up to whatever the maximum specified number of tabs is.
  3. Resolve each promise chain in its corresponding tab.
  4. Continue until tabs have been spawned / resolved for each leaf node.

So, we shouldn't need to clone tabs, each tab will just execute the same series of steps in parallel up until the query branches.

@joelgriffith

This comment has been minimized.

Show comment
Hide comment
@joelgriffith

joelgriffith Jul 19, 2017

Owner

Ah, that definitely removes some of the challenges related to having branching work as expected. I know this is entirely possible (things like join-monster do this), but would definitely take some meaty work to do so. I'll dig into how to do this, as it's a pretty interesting idea!

Owner

joelgriffith commented Jul 19, 2017

Ah, that definitely removes some of the challenges related to having branching work as expected. I know this is entirely possible (things like join-monster do this), but would definitely take some meaty work to do so. I'll dig into how to do this, as it's a pretty interesting idea!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment