-
Notifications
You must be signed in to change notification settings - Fork 582
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
Promise map improved #1775
base: main
Are you sure you want to change the base?
Promise map improved #1775
Conversation
Ruminating a little bit about not support 'race', I think that should be also done. Albeit 'race' could be simply achieved by applying race() directly to the first n items to be started concurrently, it should be supported in map() to get that function "complete" regarding the support of all possible aggregations. |
This pull request is now in conflicts. Could you fix it @mjaix? 🙏 |
1 similar comment
This pull request is now in conflicts. Could you fix it @mjaix? 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this change is blocked, since it's not rebased, but I wanted to chime in that I'm leaning toward 👎 . I think this is a bit too much to include in core Mojolicious, and I think it could be added as a role on CPAN instead.
This pull request is now in conflicts. Could you fix it @mjaix? 🙏 |
Is this PR still needed? |
Summary
Generalized Mojo::Promise::Map to also support 'any' and 'all_settled' aggregations plus an optional delay
Motivation
Since the deprecation/removal of Mojo::IOLoop::delay, the only concurrency-limiting elegant way is to use Mojo::Promise::map.
Since I need the limiting as part of a general purpose functionality, I augmented Mojo::Promise::map to support various kinds of aggregation (all[default], any, all_settled) and an optional delay between processing the promises.
Test cases as well as a cookbook entry for Mojo::Promise::map is supplied.
References
LIST RELEVANT ISSUES, PULL REQUESTS AND FORUM DISCUSSIONS HERE