api: Add Connection.IsBroken #6411

Merged
merged 2 commits into from Oct 10, 2016

Conversation

Projects
None yet
3 participants
Contributor

mjs commented Oct 10, 2016

This supports a blocking check of an api connection. It first checks the Broken channel, and if that's open tries an api ping (in most cases the ping won't be necessary).

Also updated the agent helpers to use IsBroken instead of the Broken channel when identifying failed connections. This eliminates a race and is more straightforward.

mjs added some commits Oct 9, 2016

api: Add Connection.IsBroken
This supports a blocking check of an api connection. It first checks the
Broken channel, and if that's open tries an api ping (in most cases the
ping won't be necessary).
cmd/jujud/util: Use IsBroken instead of Broken
This is more convenient and also avoids a race condition because
IsBroken will perform a ping if the broken channel is still
open. Previously it was conceivable that an API request could fail due
to a connection failure but the connection's monitor not having noticed
yet.
Contributor

mjs commented Oct 10, 2016

$$merge$$

Contributor

jujubot commented Oct 10, 2016

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@jujubot jujubot merged commit 591e287 into juju:master Oct 10, 2016

@mjs mjs deleted the mjs:api-conn-isbroken branch Oct 10, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment