~rogpeppe/juju-core/559-fix-err-deepequals

Viewing all changes in revision 2650.

[r=jameinel],[bug=1308487] state/api: save the connection as the first addr

When we connect to the API, we eventually will try all addresses listed.
We also will always save the value that we managed to connect with. This
change addresses bug #1308487, which has us move the address we
successfully connected to as the first server and address we should try
next time.

This doesn't quite give us a priority, because if we ever fail this one,
we'll go back to the default sort order except for one entry. However, I
think it still helps.

In my testing, I had to bump up the DialAddressInterval all the way up
to 500ms before we really wouldn't try most of the addresses. This is
because the time here *includes* the TLS handshake (though not the Login
round trip).

I would be happy to see the value bumped up a bit, but I don't have a
solid feeling for what is a great value there.
But since we always move the successful connection to the front, we
can expect that even if we wait a while to fall back, that will be the
uncommon case, as whatever address succeeded in the past is the most
likely to succeed the next time.

https://codereview.appspot.com/88470043/

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: