Enabled specifying additional queues to run locally

This commit is contained in:
Deon George 2021-05-04 09:41:22 +10:00
parent c4de84d51a
commit e047287407

8
init
View File

@ -5,9 +5,13 @@ role=${CONTAINER_ROLE:-app}
env=${APP_ENV:-live}
php=${PHP_DIR:-/var/www/html}
composer=${COMPOSER_DIR:-/var/www/.composer}
NO_NGINX=${NO_NGINX:-TRUE}
SSH_START=${SSH_START:-FALSE}
# To run a local queue, running jobs from the queue "hostname"
LOCAL_QUEUE=${LOCAL_QUEUE:-FALSE}
#LOCAL_QUEUES= Optional additional queues to run for
function mp() {
set +e
@ -107,9 +111,9 @@ if [ "${role}" = "app" -a -e artisan ]; then
nginx_start
if [ "${LOCAL_QUEUE}" = "TRUE" ]; then
echo "* Starting local queue ..."
echo "* Starting local queue for [${LOCAL_QUEUES}]..."
su www-data -s /bin/sh -c "
(while true; do php ${PHP_OPTIONS} artisan queue:work --verbose --tries=${WORK_TRIES:-1} --timeout=${WORK_TIMEOUT:-90} --queue=$(hostname) ${WORK_MEMORY:+--memory=${WORK_MEMORY}} ${WORK_ONCE:+--once}; done) &
(while true; do php ${PHP_OPTIONS} artisan queue:work --verbose --tries=${WORK_TRIES:-1} --timeout=${WORK_TIMEOUT:-90} --queue=$(hostname)${LOCAL_QUEUES:+,${LOCAL_QUEUES}} ${WORK_MEMORY:+--memory=${WORK_MEMORY}} ${WORK_ONCE:+--once}; done) &
"
fi