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

Send interrupted when an input observer deinitializes. #463

Merged
merged 3 commits into from
Jun 26, 2017
Merged

Conversation

andersio
Copy link
Member

Implements #461.

Checklist

  • Updated CHANGELOG.md.

@andersio andersio added this to the 2.0 milestone Jun 20, 2017
@andersio andersio changed the title [skip ci] Send interrupted when an input observer deinitializes. Send interrupted when an input observer deinitializes. Jun 20, 2017
// Since `Signal` would ensure that only one terminal event would ever be
// sent for any given `Signal`, we do not need to assert any condition
// here.
action(.interrupted)
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it mess up anything if we always sent interrupted on deinit? I'm wondering if that'd be a better option.

Copy link
Member Author

@andersio andersio Jun 27, 2017

Choose a reason for hiding this comment

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

It would mess up the promise of no event being sent after any terminal event, unless we track termimation per observer. In general attached observers do not need auto interruption.

Detaching an observer could use an interrupted event though.

Copy link
Contributor

Choose a reason for hiding this comment

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

The promise is only at the Signal level though. That wouldn't be broken.

Copy link
Member Author

@andersio andersio Jun 27, 2017

Choose a reason for hiding this comment

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

IMO Observer is part of the Signal contract.

It also breaks the useful guarantee of terminal events being sent at most once, that would potentially break things e.g. cleaning up resource twice, triggering cancellation code after successful completion.

@mdiep mdiep merged commit 033fac9 into master Jun 26, 2017
@mdiep mdiep deleted the auto-interrupt branch June 26, 2017 20:06
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

2 participants