This commit is contained in:
1340691923@qq.com 2022-03-01 11:44:45 +08:00
parent 6f436c411d
commit 090d38ffc3
4 changed files with 17 additions and 2 deletions

2
.gitignore vendored
View File

@ -16,3 +16,5 @@
/bin/linux/ /bin/linux/
/bin/win/ /bin/win/
/views/dist/ /views/dist/
main.go
task

View File

@ -80,6 +80,13 @@ func main() {
router.GET("/debug/pprof/profile", fasthttpadaptor.NewFastHTTPHandlerFunc(pprof.Profile)) router.GET("/debug/pprof/profile", fasthttpadaptor.NewFastHTTPHandlerFunc(pprof.Profile))
router.GET("/debug/pprof/symbol", fasthttpadaptor.NewFastHTTPHandlerFunc(pprof.Symbol)) router.GET("/debug/pprof/symbol", fasthttpadaptor.NewFastHTTPHandlerFunc(pprof.Symbol))
router.GET("/debug/pprof/trace", fasthttpadaptor.NewFastHTTPHandlerFunc(pprof.Trace)) 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的嵌套语法哈哈哈 //写着写着变成了flutter的嵌套语法哈哈哈
router.POST( router.POST(
"/sync_json/:typ/:appid/:appkey/:eventName/:debug", "/sync_json/:typ/:appid/:appkey/:eventName/:debug",

View File

@ -49,6 +49,10 @@ func NewReportAcceptStatus(batchSize int, flushInterval int) *ReportAcceptStatus
func (this *ReportAcceptStatus) Flush() (err error) { func (this *ReportAcceptStatus) Flush() (err error) {
this.bufferMutex.Lock() this.bufferMutex.Lock()
if len(this.buffer)==0{
this.bufferMutex.Unlock()
return nil
}
startNow := time.Now() startNow := time.Now()
@ -89,7 +93,6 @@ func (this *ReportAcceptStatus) Flush() (err error) {
if len > 0 { if len > 0 {
logs.Logger.Info("入库数据状态成功", zap.String("所花时间", lostTime), zap.Int("数据长度为", len)) logs.Logger.Info("入库数据状态成功", zap.String("所花时间", lostTime), zap.Int("数据长度为", len))
} }
} }
this.buffer = make([]ReportAcceptStatusData, 0, this.batchSize) this.buffer = make([]ReportAcceptStatusData, 0, this.batchSize)

View File

@ -39,7 +39,10 @@ func NewReportData2CK(batchSize int, flushInterval int) *ReportData2CK {
func (this *ReportData2CK) Flush() (err error) { func (this *ReportData2CK) Flush() (err error) {
this.bufferMutex.Lock() this.bufferMutex.Lock()
if len(this.buffer)==0{
this.bufferMutex.Unlock()
return nil
}
startNow := time.Now() startNow := time.Now()
rowsMap := map[string][][]interface{}{} rowsMap := map[string][][]interface{}{}