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

Ensure StateChange are posted in order to Handler #15

Merged
merged 2 commits into from
Sep 16, 2016

Conversation

kozlovic
Copy link
Member

This is another approach for solving issue #11 that was addressed
with PR #12. The advantage of this approach over #12 is that there
will be atmost 1 go-routine per type of event (StateChange and error).

Added a test that demonstrates that not receiving from state change
and error channels do not block the Node.

Also fixed a flapping test.

Resolves #11

This is another approach for solving issue #11 that was addressed
with PR #12. The advantage of this approach over #12 is that there
will be atmost 1 go-routine per type of event (StateChange and error).

Added a test that demonstrates that not receiving from state change
and error channels do not block the Node.

Also fixed a flapping test.

Resolves #11
@coveralls
Copy link

Coverage Status

Coverage increased (+0.8%) to 90.909% when pulling e31cb28 on other_take_on_state_order into 26a3418 on master.

@@ -7,7 +7,9 @@ import (
"testing"
"time"

"fmt"
Copy link
Member

Choose a reason for hiding this comment

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

sort these, all pkg ones at top and 3rd party separated by line space and at the bottom.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry about that. The IDE is integrated with go fmt, etc.. and usually orders correctly those. Not sure what happened.

n.stateChg = append(n.stateChg, sc)
// Invoke postStateChange only for the first state change added.
// Check postStateChange for details.
if len(n.stateChg) == 1 {
Copy link
Member

Choose a reason for hiding this comment

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

Can this change again before you check the length?

Copy link
Member Author

Choose a reason for hiding this comment

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

No it can't, we are under the node's lock when adding, checking and removing.

Copy link
Member

Choose a reason for hiding this comment

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

ok!

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 90.286% when pulling 420e435 on other_take_on_state_order into 26a3418 on master.

@derekcollison derekcollison merged commit 0515657 into master Sep 16, 2016
@derekcollison derekcollison deleted the other_take_on_state_order branch September 16, 2016 01:37
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.

Switching state not ordered
3 participants