1 year ago

Horizon + Heroku

Posted 1 year ago by alancole

Okay. So I have a site that makes heavy use of Redis queues so I'm trying to setup Horizon to monitor those queues correctly, but it seems a bit weird and I wonder if maybe Horizon can't do what I need or I'm missing something.

So our site runs on Heroku so I am using workers to run my background jobs. So my old Procfile looked like this.

web: vendor/bin/heroku-php-nginx -C heroku/nginx.conf public
mail: php artisan queue:work --queue=mail
sync: php artisan queue:work --queue=sync
reporting: php artisan queue:work --queue=reporting
members: php artisan queue:work --queue=members

Now we've switched to horizon it seems we've lost the ability to tell a worker which queue it should use? We need queue isolation because when we send a bit mailing we need to be able to crank up the dynos but we don't want to do that for ALL queues.

Also, php artisan horizon needs to be running on ALL workers, including by web worker, which means its also helping to process the queue. There doesn't seem to be a way to tell Horizon to just 'watch' the queue to power the web interface but not to actually work?

What I need is something like,

web: php artisan horizon:watch
mail: php artisan horizon:work --queue=mail
sync: php artisan horizon:work --queue=sync
reporting: php artisan horizon:work --queue=reporting
members: php artisan queue:work --queue=members

Where watch isn't processing any jobs, its just telling the horizon dashboard whats going on and each of the horizon works its just working its own queues (scaling as its been told to)

Any ideas?

Please sign in or create an account to participate in this conversation.