Skip to content

Commit

Permalink
fix: add MESSENGER_CONSUMER_NAME to project worker, fixes #345
Browse files Browse the repository at this point in the history
  • Loading branch information
shyim committed Apr 18, 2024
1 parent d6363dd commit c3d2df8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cmd/project/project_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,24 @@ var projectWorkerCmd = &cobra.Command{
consumeArgs = append(consumeArgs, "-vvv")
}

baseName := fmt.Sprintf("shopware-cli-%d", os.Getpid())

var wg sync.WaitGroup
for a := 0; a < workerAmount; a++ {
wg.Add(1)
go func(ctx context.Context) {
go func(ctx context.Context, index int) {
for {
cmd := phpexec.ConsoleCommand(cancelCtx, consumeArgs...)
cmd.Dir = projectRoot
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Env = append(os.Environ(), fmt.Sprintf("MESSENGER_CONSUMER_NAME=%s-%d", baseName, index))

if err := cmd.Run(); err != nil {
logging.FromContext(ctx).Fatal(err)
}
}
}(cancelCtx)
}(cancelCtx, a)
}

wg.Wait()
Expand Down

0 comments on commit c3d2df8

Please sign in to comment.