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.

Sequential Q.all()

See original GitHub issue

From the docs

“You can turn an array of promises into a promise for the whole, fulfilled array using Q.all

“If you have a number of promise-producing functions that need to be run sequentially, you can […] use the ultra-compact version. return funcs.reduce(Q.when, Q(initialVal));

Problems

  • The first approach returns a promise which eventually resolves to an array of values but it’s not guaranteed to be sequential.
  • The second approach is guaranteed to be sequential but returns a promise that eventually resolves to only one of the async calculated values.

Request

Provide a means of Q.all() which is guaranteed to execute sequentially

Please if I’m missing anything and you can do this already somehow, let me know! Thanks 😃

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:1
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
timjacobicommented, Nov 7, 2014

If I understand correctly

You do! 😉

Does this make sense?

Yes, thanks for the code! It makes perfectly sense but it’s really really verbose. That’s why I’m asking for an additional method on Q like Q.all() but sequential. Q.sequentiAll() (pun intended)…

0reactions
Cdvalenciacommented, Jul 27, 2017

posible solution

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I sequentially chain promises with angularjs $q?
Redgeoff, your own answer is the way I used to translate an array into a chained series of promises. The emergent de facto...
Read more >
$q.all() - Combining promises in AngularJS | ryansouthgate.com
$q.all() allows us to wait on an array (or object) of promises, ... on the previous - in that the promises need to...
Read more >
$q - AngularJS: API
A new instance of deferred is constructed by calling $q.defer() . The purpose of the deferred object is to expose the associated Promise...
Read more >
Promise.all() - JavaScript - MDN Web Docs
The Promise.all() method takes an iterable of promises as input and returns a single Promise . This returned promise fulfills when all of ......
Read more >
Why Using reduce() to Sequentially Resolve Promises Works
When we use it to sequentially resolve promises, the reduce() loop isn't actually slowing down at all. It's completely synchronous, doing ...
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