refactor: split worker into paid/free via WORKER_PLAN env var

Replace dual-consumer priority WorkerPool with a single consumer per
worker process. WORKER_PLAN=paid|free selects the Kafka topic and
consumer group ID (dish-recognition-paid / dish-recognition-free).

docker-compose now runs worker-paid and worker-free as separate services
for independent scaling. Makefile dev target launches both workers locally.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
dbastrikin
2026-03-19 12:11:14 +02:00
parent 1afadf50a7
commit 1aaf20619d
4 changed files with 57 additions and 61 deletions

View File

@@ -69,7 +69,7 @@ services:
volumes:
- ./firebase-credentials.json:/app/firebase-credentials.json:ro
worker:
worker-paid:
build:
context: .
dockerfile: Dockerfile
@@ -78,10 +78,25 @@ services:
DATABASE_URL: postgres://food_ai:food_ai_local@postgres:5432/food_ai?sslmode=disable
OPENAI_API_KEY: ${OPENAI_API_KEY}
KAFKA_BROKERS: kafka:9092
WORKER_PLAN: paid
depends_on:
postgres:
condition: service_healthy
kafka:
kafka-init:
condition: service_completed_successfully
worker-free:
build:
context: .
dockerfile: Dockerfile
command: ["./worker"]
environment:
DATABASE_URL: postgres://food_ai:food_ai_local@postgres:5432/food_ai?sslmode=disable
OPENAI_API_KEY: ${OPENAI_API_KEY}
KAFKA_BROKERS: kafka:9092
WORKER_PLAN: free
depends_on:
postgres:
condition: service_healthy
kafka-init:
condition: service_completed_successfully