huangrf %!s(int64=5) %!d(string=hai) anos
pai
achega
bf4e102971
Modificáronse 1 ficheiros con 19 adicións e 13 borrados
  1. 19 13
      middleware/logger_cassandra.go

+ 19 - 13
middleware/logger_cassandra.go

@@ -14,21 +14,27 @@ var __logInfoChan chan *logInfo
 var _clusterCfg *gocql.ClusterConfig = nil
 
 func init(){
-	__logInfoChan = make(chan *logInfo, 1000)
-
-	// 设置cassandar 配置
-	_clusterCfg = gocql.NewCluster("218.14.81.38")
-	_clusterCfg.Keyspace = "i2_log"
-	_clusterCfg.Consistency = gocql.Quorum
-	//设置连接池的数量,默认是2个(针对每一个host,都建立起NumConns个连接)
-	_clusterCfg.NumConns = 3
+	defer func() {
+		if p := recover(); p != nil {
+			fmt.Println("ecover", p)
+		}
+	}()
 
-	session, _ := _clusterCfg.CreateSession()
-	time.Sleep(1 * time.Second) //Sleep so the fillPool can complete.
-	defer session.Close()
+	__logInfoChan = make(chan *logInfo, 1000)
 
-	// 日志处理
-	logProcess()
+	//// 设置cassandar 配置
+	//_clusterCfg = gocql.NewCluster("218.14.81.38")
+	//_clusterCfg.Keyspace = "i2_log"
+	//_clusterCfg.Consistency = gocql.Quorum
+	////设置连接池的数量,默认是2个(针对每一个host,都建立起NumConns个连接)
+	//_clusterCfg.NumConns = 3
+	//
+	//session, _ := _clusterCfg.CreateSession()
+	//time.Sleep(1 * time.Second) //Sleep so the fillPool can complete.
+	//defer session.Close()
+
+	//// 日志处理
+	//logProcess()
 }
 
 /**