mojolicious / mojo

:sparkles: Mojolicious - Perl real-time web framework
https://mojolicious.org
Artistic License 2.0
2.67k stars 580 forks source link

Mojo::Promise and "all_settled" method for mapping promises. #1793

Open krsvital opened 3 years ago

krsvital commented 3 years ago

Steps to reproduce the behavior

it's needed to check and wait for all promises as in "all_settled" method and set concurency thougth map. if i have array for example of 100 promises, i need to set concurency for that, but only "all" method supported for "map" function.

Expected behavior

my $new = Mojo::Promise->map({concurrency => 3, behavior => 'all|all_settled|race|reject|resolve'}, sub {...}, @items);

// please add behavior option, now only "all" supported. // or add concurency option to all methods all|all_settled|race|reject|resolve

hussam-qasem commented 1 year ago

One approach:

https://stackoverflow.com/a/76893728/2035207