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

Batch multiple parallel requests into a Task #28

Closed
dalen opened this issue Jun 26, 2017 · 4 comments
Closed

Batch multiple parallel requests into a Task #28

dalen opened this issue Jun 26, 2017 · 4 comments
Labels

Comments

@dalen
Copy link

dalen commented Jun 26, 2017

It would be useful if there was a way to send multiple requests as a single task (and have all of them sent in parallel).

As using Task.map2 to batch multiple tasks together will just run them in sequence.

See https://dev.to/rtfeldman/tour-of-an-open-source-elm-spa/comments/7h2

@process-bot
Copy link

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

@evancz evancz added the request label Jul 20, 2017
@ChristophP
Copy link

Yes that would be great because it would help reduce loading times when doing requests that can be parallelized. Having an Http solution for concurrent request would be great for this would be great.

To be a bit more clear @dalen : Should the API only send request concurrently or also synchronize the responses(succeeding when all requests returned) kind of like a Promise.all() would do?

Probably also synchronizing the responses I would say, because just sending them concurrently could also be achieved with Cmd.batch. But the Cmd.batch approach sometimes forces you to compromise your model design if you actually need a combination of the results in your model instead of each of them separately.

@dalen
Copy link
Author

dalen commented Jul 23, 2017

Yeah, the responses should probably be synchronized. Otherwise the separate responses would need separate handling and responses.
Maybe some sort of subscription could be setup as an option if you want to subscribe to the progress of the requests.

@evancz
Copy link
Member

evancz commented Nov 7, 2018

There is some discussion of this topic here.

The conclusion so far in that thread is that we should get concrete examples of what people want to accomplish with something like Http.parallel2 to learn how errors and progress should be exposed by an API that allows that sort of thing.

My recommendation would be to open an issue on this repo with the title "Example where parallel requests may be ideal" and then fill the body in with the concrete scenario that you ran into in practice. At this phase, I think it's too early to speculate on the particular API that would result from that. Once we get a couple different people sharing examples here in that particular format, I can organize it into one place and see if there is a design that covers everyone nicely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants