优化
This commit is contained in:
parent
6f436c411d
commit
090d38ffc3
2
.gitignore
vendored
2
.gitignore
vendored
@ -16,3 +16,5 @@
|
||||
/bin/linux/
|
||||
/bin/win/
|
||||
/views/dist/
|
||||
main.go
|
||||
task
|
||||
|
@ -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",
|
||||
|
@ -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)
|
||||
|
@ -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{}{}
|
||||
|
Loading…
x
Reference in New Issue
Block a user