I want to create a new puppeteer browser when a Laravel Worker gets created.
Right now, my Horizon config allows for a minimum of 2 and a maximum of 10 workers running. As demand increases and workers are created, I'd like to create a new browser for Puppeteer. When a worker is removed, it can close that browser.
Are there any Laravel events that would work for this? Or am I coming at this the wrong way?
I looked into puppeteer-cluster, but that's another queue to interact with when I already have one with Laravel. And the puppeteer-pool is out of date.
This is the current list of built-in events for queuing in Laravel 11:
Loopingsounds like the right event, you can give that a try.If not, you can create a new event named
QueueStartingand create a PR to the framework.