Browse Source

fix:redis问题

Roc 10 months ago
parent
commit
39dfeea8b8
1 changed files with 6 additions and 2 deletions
  1. 6 2
      services/binlog/binlog.go

+ 6 - 2
services/binlog/binlog.go

@@ -170,9 +170,13 @@ func getBinlogNamePosition() (fileName string, position uint32, err error) {
 	fileName = global.Rc.GetStr(utils.CACHE_MYSQL_MASTER_FILENAME)
 	position64, err := global.Rc.GetUInt64(utils.CACHE_MYSQL_MASTER_POSITION)
 	if err != nil && err.Error() != utils.RedisNoKeyErr {
-		panic("mysql binlog position is not found,err:" + err.Error())
-		return
+		if err.Error() != utils.RedisNoKeyErr {
+			panic("mysql binlog position is not found,err:" + err.Error())
+			return
+		}
+		err = nil
 	}
+
 	position = uint32(position64)
 
 	// 如果没有从redis中获取到上次监听到的binlog的文件名称,或者位置为0,则从mysql中获取,则从 MySQL 中获取最新的文件名和位置。