Skip to content

Commit

Permalink
Improve messenger async consumer
Browse files Browse the repository at this point in the history
  • Loading branch information
k-37 committed Nov 12, 2024
1 parent be0fe1e commit 011eb00
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion compose.override.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ services:
build:
context: .
target: frankenphp_dev
command: ['/app/bin/console', 'messenger:consume', 'events', '-vvv', '--time-limit=60', '--limit=10', '--memory-limit=128M']
command: ['bin/console', 'messenger:consume', 'events', '-vvv', '--time-limit=60', '--limit=10', '--memory-limit=128M']
volumes:
- ./:/app
- /app/var/
Expand Down
14 changes: 12 additions & 2 deletions compose.prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,18 @@ services:
MERCURE_SUBSCRIBER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET}

php-worker:
profiles:
- donotstart

php-worker-events:
extends:
file: compose.yaml
service: php-worker
image: ${IMAGES_PREFIX:-}app-php-worker-events
build:
context: .
target: frankenphp_prod
environment:
APP_SECRET: ${APP_SECRET}
command: ['bin/console', 'messenger:consume', 'events', '-vvv', '--time-limit=60', '--limit=10', '--memory-limit=128M']
depends_on:
php:
condition: service_healthy
3 changes: 1 addition & 2 deletions etc/frankenphp/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ if [ "$1" = 'frankenphp' ] || [ "$1" = 'php' ] || [ "$1" = 'bin/console' ]; then
composer install --prefer-dist --no-progress --no-interaction
fi

run_migrations=${RUN_MIGRATIONS:-true}
if grep -q ^DATABASE_URL= .env && [ "$run_migrations" = "true" ]; then
if grep -q ^DATABASE_URL= .env && [ "${RUN_MIGRATIONS:-true}" = "true" ]; then
echo "Waiting for database to be ready..."
ATTEMPTS_LEFT_TO_REACH_DATABASE=60
until [ $ATTEMPTS_LEFT_TO_REACH_DATABASE -eq 0 ] || DATABASE_ERROR=$(php bin/console dbal:run-sql -q "SELECT 1" 2>&1); do
Expand Down
2 changes: 1 addition & 1 deletion etc/helm/dolphin/templates/deployment-workers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ spec:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.php.image.repository }}:{{ .Values.php.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.php.image.pullPolicy }}
command: ['/app/bin/console', 'messenger:consume', 'events', '-vvv', '--time-limit=60', '--limit=10', '--memory-limit=128M']
command: ['bin/console', 'messenger:consume', 'events', '-vvv', '--time-limit=60', '--limit=10', '--memory-limit=128M']
env:
- name: RUN_MIGRATIONS
value: "false"
Expand Down

0 comments on commit 011eb00

Please sign in to comment.