提交代码

This commit is contained in:
lmk
2026-07-02 10:23:07 +08:00
parent 7f6ec3a757
commit 802139c349
24 changed files with 7373 additions and 314 deletions
+5 -6
View File
@@ -15,6 +15,7 @@ import (
entity "dataengine/model/entity/dict"
"gitea.redpowerfuture.com/red-future/common/db/gfdb"
"github.com/gogf/gf/v2/os/grpool"
"github.com/sirupsen/logrus"
)
@@ -595,16 +596,14 @@ func syncWithPrefetch(ctx context.Context, api *ApiClient, platform *PlatformCon
var mu sync.Mutex
var wg sync.WaitGroup
sem := make(chan struct{}, concurrency)
pool := grpool.New(concurrency)
globalMaxTime := lastSyncTime
for idx, entityVal := range allEntities {
idx, val := idx, entityVal
wg.Add(1)
sem <- struct{}{}
go func(idx int, val interface{}) {
pool.Add(ctx, func(ctx context.Context) {
defer wg.Done()
defer func() { <-sem }()
logrus.Infof(" 处理实体 [%d/%d]: %v", idx+1, len(allEntities), val)
entityMaxTime := int64(0)
@@ -728,7 +727,7 @@ func syncWithPrefetch(ctx context.Context, api *ApiClient, platform *PlatformCon
}
mu.Unlock()
}
}(idx, entityVal)
})
}
wg.Wait()