a8n: Enqueue CampaignJobs in goroutine to not block request
Created by: mrnugget
This was an oversight on my part when doing #6598. (I think I failed a lot of "Concurrency in Go" tests in the past 24 hours.)
Since #6598 we have a fixed number of workers working off CampaignJobs
. We only want to wait for their completion by calling (&Runner).Wait
.
The previous version of the code here, though, blocked until all jobs were enqueued. And since the queue is an unbuffered channel, that might take a while since we only ever work off $num-of-workers at the same time.
This fixes what @eseliger reported in Slack