Skip to content
This repository has been archived by the owner on Sep 25, 2018. It is now read-only.

Commit

Permalink
result string formation
Browse files Browse the repository at this point in the history
  • Loading branch information
alastairruhm committed May 2, 2018
1 parent a9f411f commit 96515b4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions client/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (c *Cluster) CheckConnection() string {
var checkGroup sync.WaitGroup
go func(vip config.Vip) {
checkGroup.Add(1)
result := fmt.Sprintf("check VIP %s connection: ", vip.IP)
result := fmt.Sprintf("check VIP %s connection: ", vip.IP)
result = result + CheckDBConnection(c.Username, c.Password, vip.IP, strconv.Itoa(vip.Port)) + "\n"
// fmt.Println("check vip ", vip.IP)
chVip <- result
Expand All @@ -71,7 +71,7 @@ func (c *Cluster) CheckConnection() string {
for _, atlas := range c.AtlasNodes {
atlasGroup.Add(1)
go func(a config.Atlas) {
result := fmt.Sprintf("check Atlas %s connection: ", a.IP)
result := fmt.Sprintf("check Atlas %s connection: ", a.IP)
result = result + CheckDBConnection(c.Username, c.Password, a.IP, strconv.Itoa(a.Port)) + "\n"
// fmt.Println("check atlas ", a.IP)
chAtlas <- result
Expand Down Expand Up @@ -155,11 +155,11 @@ func CheckDBConnection(user string, pass string, host string, port string) strin
db, err := NewDBConn(user, pass, host, port)
defer db.Close()
if err != nil {
return err.Error()
return fmt.Sprintf("%s - %s", "ERROR", err.Error())
}
err = db.Ping()
if err != nil {
return err.Error()
return fmt.Sprintf("%s - %s", "ERROR", err.Error())
}
return "OK"
}
Expand Down

0 comments on commit 96515b4

Please sign in to comment.