fix(celery): cap worker memory at 3g
All checks were successful
CI/CD Pipeline / Code Quality Checks (push) Successful in 1m38s
CI/CD Pipeline / Run Tests (push) Successful in 2m58s
CI/CD Pipeline / Telegram Notify Success (push) Successful in 19s

This commit is contained in:
2026-03-23 10:29:09 +01:00
parent c28b603831
commit b4260d53cb
3 changed files with 12 additions and 1 deletions

View File

@@ -84,11 +84,16 @@ services:
target: runtime-celery target: runtime-celery
container_name: mostovik_celery_worker container_name: mostovik_celery_worker
restart: unless-stopped restart: unless-stopped
environment:
CELERY_WORKER_CONCURRENCY: "1"
CELERY_WORKER_MAX_MEMORY_PER_CHILD_KB: "3145728"
env_file: env_file:
- .env.dev - .env.dev
depends_on: depends_on:
migrate: migrate:
condition: service_completed_successfully condition: service_completed_successfully
mem_limit: 3g
memswap_limit: 3g
volumes: volumes:
- ./src:/app/src - ./src:/app/src
- ./logs:/app/logs - ./logs:/app/logs

View File

@@ -48,11 +48,16 @@ services:
image: ${CELERY_IMAGE:-mostovik/celery:latest} image: ${CELERY_IMAGE:-mostovik/celery:latest}
container_name: mostovik_celery_worker container_name: mostovik_celery_worker
restart: unless-stopped restart: unless-stopped
environment:
CELERY_WORKER_CONCURRENCY: "1"
CELERY_WORKER_MAX_MEMORY_PER_CHILD_KB: "3145728"
env_file: env_file:
- .env.prod - .env.prod
depends_on: depends_on:
migrate: migrate:
condition: service_completed_successfully condition: service_completed_successfully
mem_limit: 3g
memswap_limit: 3g
volumes: volumes:
- ./logs:/app/logs - ./logs:/app/logs
- ./input:/app/input - ./input:/app/input

View File

@@ -17,4 +17,5 @@ esac
exec celery -A core worker \ exec celery -A core worker \
--loglevel="${CELERY_LOG_LEVEL:-INFO}" \ --loglevel="${CELERY_LOG_LEVEL:-INFO}" \
--concurrency="${CELERY_WORKER_CONCURRENCY:-2}" --concurrency="${CELERY_WORKER_CONCURRENCY:-1}" \
--max-memory-per-child="${CELERY_WORKER_MAX_MEMORY_PER_CHILD_KB:-3145728}"