mojo icon indicating copy to clipboard operation
mojo copied to clipboard

Promise map improved

Open mjaix opened this issue 4 years ago • 5 comments

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

mjaix avatar Apr 30 '21 22:04 mjaix

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.

mjaix avatar May 02 '21 22:05 mjaix

This pull request is now in conflicts. Could you fix it @mjaix? 🙏

mergify[bot] avatar Jul 06 '23 16:07 mergify[bot]

This pull request is now in conflicts. Could you fix it @mjaix? 🙏

mergify[bot] avatar Aug 14 '23 10:08 mergify[bot]

This pull request is now in conflicts. Could you fix it @mjaix? 🙏

mergify[bot] avatar Mar 06 '24 19:03 mergify[bot]