-
Notifications
You must be signed in to change notification settings - Fork 253
Fix find primary timeout #2284
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 find primary timeout #2284
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| Just want to be making daily records | ||
| Just want to be making daily records. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -695,14 +695,17 @@ def find_primary(self, timeout=3, log_capture=None): | |
| try: | ||
| logs = [] | ||
| res = c.get("/node/network", log_capture=logs) | ||
| if res.status_code != 200: | ||
| continue | ||
| assert res.status_code == http.HTTPStatus.OK.value, res | ||
|
|
||
| body = res.body.json() | ||
| view = body["current_view"] | ||
| if "primary_id" not in body: | ||
| continue | ||
|
|
||
| view_change_in_progress = body["view_change_in_progress"] | ||
| primary_id = body["primary_id"] | ||
| if primary_id is not None: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not now, but when @jumaffre and I talked about it, I suggested we should always have a primary_id and it should be set to null when it's unknown, rather than not have the key at all when we don't know which node is primary. There's a more general point here about what do for optional fields in our JSON responses, we can talk about it.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's discuss (and agree on) this separately. I'll merge this PR as it is as it is blocking other PRs and will address further changes in a follow-up PR. |
||
| break | ||
|
|
||
| except CCFConnectionException: | ||
| LOG.warning( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
/node/networkendpoint isn't guaranteed to return200but at this stage, we only loop through nodes that have joined the service so this assert is actually safe.