xmaker: add comments

This commit is contained in:
c9s 2024-08-27 14:52:27 +08:00
parent 6fb6467d59
commit 199b86df86
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -1037,8 +1037,12 @@ func (s *Strategy) CrossRun(
go s.quoteWorker(ctx) go s.quoteWorker(ctx)
bbgo.OnShutdown(ctx, func(ctx context.Context, wg *sync.WaitGroup) { bbgo.OnShutdown(ctx, func(ctx context.Context, wg *sync.WaitGroup) {
// the ctx here is the shutdown context (not the strategy context)
// defer work group done to mark the strategy as stopped
defer wg.Done() defer wg.Done()
// send stop signal to the quoteWorker
close(s.stopC) close(s.stopC)
// wait for the quoter to stop // wait for the quoter to stop
@ -1048,7 +1052,7 @@ func (s *Strategy) CrossRun(
log.WithError(err).Errorf("graceful cancel error") log.WithError(err).Errorf("graceful cancel error")
} }
bbgo.Notify("%s: %s position", ID, s.Symbol, s.Position) bbgo.Notify("Shutting down %s %s", ID, s.Symbol, s.Position)
}) })
return nil return nil