Skip to content
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

Restore promise map #1513

Closed
wants to merge 2 commits into from
Closed

Restore promise map #1513

wants to merge 2 commits into from

Conversation

jberger
Copy link
Member

@jberger jberger commented May 19, 2020

Summary

Restore Mojo::Promise::map and improve where there were concerns

Motivation

Because it was mostly ok, just needed some tweaks, and it is very useful

I have improved the test case to fail when the $proto promise wasn't cloned, however, I have then removed the $proto promise all together as an attempt to prevent warnings as we attempt to warn on unhandled rejected promises.

…test coverage was lacking, getting in the way of new feature development"

This reverts commit c949f57.
also adds comments and removes an intermediate promise
@jberger
Copy link
Member Author

jberger commented May 19, 2020

Note that it might be easier to review the comparison from before map was removed (and is restored in this PR): https://github.com/mojolicious/mojo/compare/3ca458038..restore_promise_map

@jberger
Copy link
Member Author

jberger commented May 19, 2020

I'll also note that the weaken on the $loop is only needed because we close over $loop to return a rejection here. If "die" would work to "rethrow" the error then that weaken could be removed.

Copy link
Member

@jhthorsen jhthorsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍

@kraih
Copy link
Member

kraih commented May 20, 2020

It does not look good to me, weaken $loop is a pretty ugly hack.

@jberger
Copy link
Member Author

jberger commented May 20, 2020

Closing as superseded by a1f6d8a

@jberger jberger closed this May 20, 2020
@kraih kraih deleted the restore_promise_map branch May 26, 2020 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants