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

Fix Heartbeat._bind_socket to return on the first successful bind. #431

Merged
merged 2 commits into from
Sep 12, 2019
Merged

Fix Heartbeat._bind_socket to return on the first successful bind. #431

merged 2 commits into from
Sep 12, 2019

Conversation

mdickinson
Copy link
Contributor

This PR changes the Heartbeat._bind_socket code so that it returns on the first successful bind; it also adds a regression test.

Fixes #430.

@@ -21,6 +21,14 @@ def test_port_bind_failure_raises():
assert mock_try_bind.call_count == 1


def test_port_bind_failure_succeeds():
Copy link
Contributor Author

@mdickinson mdickinson Sep 12, 2019

Choose a reason for hiding this comment

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

Aargh; that's a bad test name. I'll fix to remove the "failure" text.

def test_port_bind_failure_succeeds():
heart = Heartbeat(None)
with patch.object(heart, '_try_bind_socket') as mock_try_bind:
mock_try_bind.side_effect = lambda: None
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This line could probably just be removed.

@blink1073
Copy link
Member

LGTM, thank you!

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.

Heartbeat._bind_socket continually retries on success
2 participants