Commit f0dce6d6 by 孙龙

init

parent b548381f
package apiMsgService
import (
"fmt"
"go-api-behavior/util"
"context"
//"fmt"
"go.mongodb.org/mongo-driver/mongo"
"context"
"go.mongodb.org/mongo-driver/mongo/options"
"time"
)
......@@ -57,7 +56,7 @@ func (logSink *LogSink) writeLoop() {
for {
select {
case log = <- logSink.logChan:
fmt.Println("新任务")
//fmt.Println("新任务")
if logBatch == nil {
logBatch = &LogBatch{}
}
......@@ -75,8 +74,8 @@ func (logSink *LogSink) writeLoop() {
if logBatch == nil {
logBatch = &LogBatch{}
}
fmt.Println("超时到期了")
fmt.Println(len(logBatch.Logs))
//fmt.Println("超时到期了")
//fmt.Println(len(logBatch.Logs))
logSink.saveLogs(logBatch)
logBatch = nil
t.Reset(time.Second * 20)
......
......@@ -17,7 +17,7 @@ type RecvPro struct {
//// 实现消费者 消费消息失败 自动进入延时尝试 尝试3次之后入库db
func (t *RecvPro) Consumer(dataByte []byte) error {
fmt.Println(string(dataByte))
//fmt.Println(string(dataByte))
err := apiMsgService.SaveMsgToLogChan(string(dataByte))
if err != nil{
logger.Error("%s",err)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment