优化
This commit is contained in:
parent
9e7b2a1673
commit
324bea4b23
@ -15,6 +15,7 @@ import (
|
||||
"go.uber.org/zap"
|
||||
"io"
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
@ -232,7 +233,7 @@ func InitDebugSarama() (fn func(), err error) {
|
||||
|
||||
func RefreshTableId() (fn func(), err error) {
|
||||
fn = func() {
|
||||
go report.RefreshTableIdMap()
|
||||
go report.RefreshTableIdMap(5*time.Minute)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -22,9 +22,9 @@ type ReportService struct {
|
||||
|
||||
var tableIdMap sync.Map
|
||||
|
||||
func RefreshTableIdMap() {
|
||||
func RefreshTableIdMap(t time.Duration) {
|
||||
for {
|
||||
time.Sleep(time.Minute * 10)
|
||||
time.Sleep(t)
|
||||
tableIdMap.Range(func(key, value interface{}) bool {
|
||||
tableIdMap.Delete(key)
|
||||
return true
|
||||
@ -32,10 +32,6 @@ func RefreshTableIdMap() {
|
||||
}
|
||||
}
|
||||
|
||||
func NewReportService() *ReportService {
|
||||
return &ReportService{buff: bytes.Buffer{}}
|
||||
}
|
||||
|
||||
func (this *ReportService) GetTableid(appid, appkey string) (table string, err error) {
|
||||
|
||||
this.buff.Reset()
|
||||
|
Loading…
x
Reference in New Issue
Block a user