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

Cancel other promises when one of any composition got fulfilled #17

Open
mzaks opened this issue Apr 11, 2014 · 1 comment
Open

Cancel other promises when one of any composition got fulfilled #17

mzaks opened this issue Apr 11, 2014 · 1 comment
Assignees
Milestone

Comments

@mzaks
Copy link

mzaks commented Apr 11, 2014

When you do
[OMPromise any:@[A, B, C]];
and e.g. B is fulfilled.
Wouldn't it be cool to cancel A and C.
It's not a big deal, but users may expect such behavior, special when there is a cancel method on promises.
Same is true for progress. If we have an any concatenation, we are done (100% progress) when any of the promises is fulfilled.

@aomader aomader self-assigned this Apr 18, 2014
@aomader
Copy link
Owner

aomader commented Apr 18, 2014

I don't think that should be the default behavior. Some people might use one of your combined promises A, B or C also in another context and they would be surprised if it gets canceled.
But we could add a second version of this combinator which adds the option to cancel all remaining promises, something like - any:(NSArray *)promises cancel:(BOOL)cancel;. I think that would be a good addition.
In this context it might also make sense to add a similar addition for the all: combinator, which cancels all other promises in case one fails.

@aomader aomader added this to the 0.4.0 milestone May 6, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants