fix(integration): move waitgroup Add(1) outside goroutine to avoid potential issue (#10070)

Signed-off-by: googs1025 <googs1025@gmail.com>
This commit is contained in:
CYJiang 2025-04-09 06:17:40 +08:00 committed by GitHub
parent d98bfe7e70
commit e7019c9455
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -52,8 +52,8 @@ func TestMaxQueue(t *testing.T) {
embedCtx := ctx
var genwg sync.WaitGroup
genwg.Add(1)
go func() {
genwg.Add(1)
defer genwg.Done()
slog.Info("Starting generate request")
DoGenerate(ctx, t, client, req, resp, 45*time.Second, 5*time.Second)
@ -71,8 +71,8 @@ func TestMaxQueue(t *testing.T) {
counterMu := sync.Mutex{}
var embedwg sync.WaitGroup
for i := 0; i < threadCount; i++ {
embedwg.Add(1)
go func(i int) {
embedwg.Add(1)
defer embedwg.Done()
slog.Info("embed started", "id", i)
embedReq := api.EmbeddingRequest{