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

Fixing ticket #1650 #219

Merged
merged 9 commits into from Jan 17, 2012
Merged

Fixing ticket #1650 #219

merged 9 commits into from Jan 17, 2012

Conversation

viktorklang
Copy link
Member

Removing the flawed orElse and replacing it with the more awesomized "or".

def register(to: Future[U]) = to onComplete {
case r @ Right(_) ⇒ p tryComplete r
case l @ Left(_) ⇒ that.value match {
case Some(Left(_)) ⇒ p tryComplete l //If he failed, race for setting failure
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like it 'that' fails before 'this' succeeds the promise will be completed with the failure. Is this intentional, or should register take both futures as args (instead of hardcoding 'that')?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice catch! :-)

@viktorklang
Copy link
Member Author

I've changed the semantics to cascade only failures.

val p = Promise[U]()
onComplete {
case r @ Right(_) ⇒ p complete r
case _ ⇒ that onSuccess { case r ⇒ p success r }
Copy link
Contributor

Choose a reason for hiding this comment

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

is it intentional that if that also fails, p is never completed? (I as a user would not expect that kind of behavior)

Copy link
Member Author

Choose a reason for hiding this comment

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

What would you expect? The failure of the first, or of the second?

@viktorklang
Copy link
Member Author

Can I merge now plz?

@rkuhn
Copy link
Contributor

rkuhn commented Jan 17, 2012

u can haz me smiley: :)

viktorklang added a commit that referenced this pull request Jan 17, 2012
@viktorklang viktorklang merged commit c71514b into master Jan 17, 2012
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.

None yet

3 participants