xdepthmaker: fix loopvar issue

This commit is contained in:
c9s 2024-03-05 21:16:35 +08:00
parent 26c34618b2
commit 0d3483e7c3
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -51,8 +51,10 @@ func (f *ProfitFixer) Fix(ctx context.Context, since, until time.Time, stats *ty
var allTrades = make([]types.Trade, 0, 1000)
g, subCtx := errgroup.WithContext(ctx)
for n, service := range f.sessions {
for n, s := range f.sessions {
// allocate a copy of the iteration variables
sessionName := n
service := s
g.Go(func() error {
log.Infof("batch querying %s trade history from %s since %s until %s", f.market.Symbol, sessionName, since.String(), until.String())
trades, err := f.batchQueryTrades(subCtx, service, f.market.Symbol, since, until)