question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is there a way to run multiple requests in paralell?

See original GitHub issue

When I try to run the following code I only see the last request beeing sent. Is there a way I can send multiple requests. The reason I want to do this is to fire the requests in a synchronous manner, but I handle the responses outside this loop.

this.authHttp.patch(patchUrl, { id: 'field1', value: 1 })
this.authHttp.patch(patchUrl, { id: 'field2', value: 2 })
this.authHttp.patch(patchUrl, { id: 'field3', value: 3 })

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
escardincommented, Apr 11, 2017

switchmap cancels in progress queries in favour of the new one afaik.

the subscription will not forward any data via the returned result. if you then subscribe to the switchmap, you will end up with two subscriptions per action.

Yes this question is entirely an rxjs usage issue and nothing to do with us. I happen to like these questions though.

const patchUrl = 'http://host/patch';
this.actions$
        .ofType('ACTION_TYPE')
        .switchMap(([action]) => this.authHttp.patch(patchUrl, action.payload))
        .map(res => ({ type: 'NEW_ACTION' }))
        .catch(() => Observable.of({ type: 'FAILED' }))
        .subscribe(v => console.log(v));
0reactions
stale[bot]commented, Oct 26, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you have not received a response for our team (apologies for the delay) and this is still a blocker, please reply with additional information or just a ping. Thank you for your contribution! 🙇‍♂️

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to make multiple API requests in parallel? - RapidAPI
It can be tricky to figure out how to make parallel but asynchronous API calls. In JavaScript, you can use the Promise.all() method...
Read more >
Postman: How to make multiple requests at the same time
Just create a runner with some requests and click the "Run" button multiple times to bring up multiple instances.
Read more >
Perform multiple requests in parallel — multi_req_perform • httr2
This variation on req_perform() performs multiple requests in parallel. Unlike req_perform() it always succeeds; it will never throw an error.
Read more >
How can I run simultaneous request parallely - Help - Postman
Open your requests in new Postman windows, not tabs. Then stack the windows so the Send buttons can be clicked fast. 1 Like....
Read more >
How to run many parallel HTTP requests using Node.js
But, it is possible to process multiple requests parallelly using the NodeJS cluster module or worker_threads module. How to scale your NodeJS ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found