This commit is contained in:
1340691923@qq.com 2022-03-04 10:46:44 +08:00
parent 9e7b2a1673
commit 324bea4b23
2 changed files with 4 additions and 7 deletions

View File

@ -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
}

View File

@ -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()