feat(worker): 支持 WORKER_CONCURRENCY 环境变量控制 Celery 并发数 (#208)
CI/CD Pipeline / Validate Code Quality And Tests (push) Failing after 9s
CI/CD Pipeline / Production Browser E2E (push) Failing after 1625h20m15s
CI/CD Pipeline / Deploy Production (push) Failing after 1625h20m17s
CI/CD Pipeline / Staging API Integration Tests (push) Failing after 1625h20m17s
CI/CD Pipeline / Staging E2E Tests (push) Failing after 1625h20m17s
CI/CD Pipeline / Build Production Runtime Images (push) Failing after 1625h20m19s
CI/CD Pipeline / Build & Push Staging (Watchtower auto-deploy) (push) Failing after 1625h20m19s
CI/CD Pipeline / Frontend Lint (push) Has been skipped
CI/CD Pipeline / Validate Code Quality And Tests (push) Failing after 9s
CI/CD Pipeline / Production Browser E2E (push) Failing after 1625h20m15s
CI/CD Pipeline / Deploy Production (push) Failing after 1625h20m17s
CI/CD Pipeline / Staging API Integration Tests (push) Failing after 1625h20m17s
CI/CD Pipeline / Staging E2E Tests (push) Failing after 1625h20m17s
CI/CD Pipeline / Build Production Runtime Images (push) Failing after 1625h20m19s
CI/CD Pipeline / Build & Push Staging (Watchtower auto-deploy) (push) Failing after 1625h20m19s
CI/CD Pipeline / Frontend Lint (push) Has been skipped
This commit was merged in pull request #208.
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
# Worker 启动脚本 — 支持 WORKER_CONCURRENCY 环境变量
|
||||
# 未设置时默认 2(保持向后兼容)
|
||||
|
||||
set -e
|
||||
|
||||
CONCURRENCY="${WORKER_CONCURRENCY:-2}"
|
||||
|
||||
exec celery \
|
||||
-A worker_app.celery_app \
|
||||
worker \
|
||||
--loglevel=info \
|
||||
"--concurrency=${CONCURRENCY}"
|
||||
@@ -51,6 +51,10 @@ COPY packages/ /app/packages/
|
||||
COPY alembic.ini /app/alembic.ini
|
||||
COPY migrations/ /app/migrations/
|
||||
|
||||
# 复制 Worker 启动脚本(支持 WORKER_CONCURRENCY 环境变量)
|
||||
COPY infra/docker/entrypoint-worker.sh /usr/local/bin/entrypoint-worker.sh
|
||||
RUN chmod +x /usr/local/bin/entrypoint-worker.sh
|
||||
|
||||
# 设置 Python 路径
|
||||
ENV PATH="/opt/venv/bin:$PATH"
|
||||
ENV PYTHONPATH=/app
|
||||
@@ -65,4 +69,4 @@ USER celery
|
||||
|
||||
# Worker 入口点
|
||||
WORKDIR /app/apps/worker
|
||||
CMD ["celery", "-A", "worker_app.celery_app", "worker", "--loglevel=info", "--concurrency=2"]
|
||||
CMD ["/usr/local/bin/entrypoint-worker.sh"]
|
||||
|
||||
Reference in New Issue
Block a user