diff --git a/.gitignore b/.gitignore index 773fc67..862c80d 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,5 @@ /bin/linux/ /bin/win/ /views/dist/ +main.go +task diff --git a/cmd/report_server/main.go b/cmd/report_server/main.go index 29c993f..972573f 100644 --- a/cmd/report_server/main.go +++ b/cmd/report_server/main.go @@ -80,6 +80,13 @@ func main() { router.GET("/debug/pprof/profile", fasthttpadaptor.NewFastHTTPHandlerFunc(pprof.Profile)) router.GET("/debug/pprof/symbol", fasthttpadaptor.NewFastHTTPHandlerFunc(pprof.Symbol)) router.GET("/debug/pprof/trace", fasthttpadaptor.NewFastHTTPHandlerFunc(pprof.Trace)) + router.GET("/debug/pprof/allocs", fasthttpadaptor.NewFastHTTPHandlerFunc(pprof.Handler("allocs").ServeHTTP)) + router.GET("/debug/pprof/block", fasthttpadaptor.NewFastHTTPHandlerFunc(pprof.Handler("block").ServeHTTP)) + router.GET("/debug/pprof/goroutine", fasthttpadaptor.NewFastHTTPHandlerFunc(pprof.Handler("goroutine").ServeHTTP)) + router.GET("/debug/pprof/heap", fasthttpadaptor.NewFastHTTPHandlerFunc(pprof.Handler("heap").ServeHTTP)) + router.GET("/debug/pprof/mutex", fasthttpadaptor.NewFastHTTPHandlerFunc(pprof.Handler("mutex").ServeHTTP)) + router.GET("/debug/pprof/threadcreate", fasthttpadaptor.NewFastHTTPHandlerFunc(pprof.Handler("threadcreate").ServeHTTP)) + //写着写着变成了flutter的嵌套语法哈哈哈 router.POST( "/sync_json/:typ/:appid/:appkey/:eventName/:debug", diff --git a/platform-basic-libs/service/consumer_data/report_accpet_status.go b/platform-basic-libs/service/consumer_data/report_accpet_status.go index 6bcc0ad..b038743 100644 --- a/platform-basic-libs/service/consumer_data/report_accpet_status.go +++ b/platform-basic-libs/service/consumer_data/report_accpet_status.go @@ -49,6 +49,10 @@ func NewReportAcceptStatus(batchSize int, flushInterval int) *ReportAcceptStatus func (this *ReportAcceptStatus) Flush() (err error) { this.bufferMutex.Lock() + if len(this.buffer)==0{ + this.bufferMutex.Unlock() + return nil + } startNow := time.Now() @@ -89,7 +93,6 @@ func (this *ReportAcceptStatus) Flush() (err error) { if len > 0 { logs.Logger.Info("入库数据状态成功", zap.String("所花时间", lostTime), zap.Int("数据长度为", len)) } - } this.buffer = make([]ReportAcceptStatusData, 0, this.batchSize) diff --git a/platform-basic-libs/service/consumer_data/reportdata2ck.go b/platform-basic-libs/service/consumer_data/reportdata2ck.go index be27117..18b7fb0 100644 --- a/platform-basic-libs/service/consumer_data/reportdata2ck.go +++ b/platform-basic-libs/service/consumer_data/reportdata2ck.go @@ -39,7 +39,10 @@ func NewReportData2CK(batchSize int, flushInterval int) *ReportData2CK { func (this *ReportData2CK) Flush() (err error) { this.bufferMutex.Lock() - + if len(this.buffer)==0{ + this.bufferMutex.Unlock() + return nil + } startNow := time.Now() rowsMap := map[string][][]interface{}{}