set timeout for creation of connection between UI and DB

This commit is contained in:
Wenkai Yin 2016-04-20 14:44:19 +08:00
parent ba69666509
commit b5b22350d1

View File

@ -77,7 +77,7 @@ func InitDB() {
var err error
var c net.Conn
for {
c, err = net.Dial("tcp", addr+":"+port)
c, err = net.DialTimeout("tcp", addr+":"+port, 20*time.Second)
if err == nil {
c.Close()
ch <- 1