Browse Source

fix:binlog监听

Roc 1 year ago
parent
commit
cc123bf717
1 changed files with 9 additions and 0 deletions
  1. 9 0
      services/binlog/binlog.go

+ 9 - 0
services/binlog/binlog.go

@@ -1,6 +1,7 @@
 package binlog
 
 import (
+	"errors"
 	"eta/eta_bridge/global"
 	"eta/eta_bridge/models/index"
 	"eta/eta_bridge/utils"
@@ -44,6 +45,10 @@ func init() {
 		}
 	}
 
+	if mysqlHost == "" {
+		panic("mysqlHost is empty")
+	}
+
 	//fmt.Println("HOST:", mysqlHost)
 	//fmt.Println("user:", mysqlUser)
 	//fmt.Println("password:", mysqlPwd)
@@ -57,6 +62,10 @@ func ListenMysql() {
 			fmt.Println("数据库监听服务异常,err:", err)
 		}
 	}()
+	if mysqlHost == "" {
+		err = errors.New("mysqlHost is empty")
+		return
+	}
 	//includeTableRegex := []string{
 	//	"test_hz_data.edb_info",
 	//}