Skip to content

Commit b713d74

Browse files
committed
Tidy cluster connection code
1 parent 7f8060f commit b713d74

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

cluster.go

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -222,17 +222,6 @@ func (c *Cluster) connectNodes(hosts []Host) {
222222
}
223223
defer conn.Close()
224224

225-
svrRsp, err := conn.Server()
226-
if err != nil {
227-
Log.Warnf("Error fetching server ID: %s", err)
228-
continue
229-
}
230-
231-
// TODO: connect to seed hosts using `.Server()` to get server ID. Need
232-
// some way of making this backwards compatible
233-
234-
// TODO: AFTER try to discover hosts
235-
236225
if c.opts.DiscoverHosts {
237226
q, err := newQuery(
238227
DB("rethinkdb").Table("server_status"),
@@ -271,6 +260,12 @@ func (c *Cluster) connectNodes(hosts []Host) {
271260
}
272261
}
273262
} else {
263+
svrRsp, err := conn.Server()
264+
if err != nil {
265+
Log.Warnf("Error fetching server ID: %s", err)
266+
continue
267+
}
268+
274269
node, err := c.connectNode(svrRsp.ID, []Host{host})
275270
if err == nil {
276271
if _, ok := nodeSet[node.ID]; !ok {

0 commit comments

Comments
 (0)