File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -7,8 +7,16 @@ VERIFY_SSL=true
77
88# Queue configuration
99MAX_QUEUE_SIZE = 100
10- RATE_LIMIT_REQUESTS = 30
11- RATE_LIMIT_WINDOW = 60
10+
11+ # Celery Worker Configuration
12+ # CELERY_CONCURRENCY=4 # Used in Docker startup command, not directly by Python
13+ CELERY_TASK_TIME_LIMIT = 300 # Max time in seconds for a task to run (default: 300)
14+ CELERY_WORKER_PREFETCH_MULTIPLIER = 5 # How many tasks a worker fetches ahead (default: 5)
15+ CELERY_WORKER_MAX_TASKS_PER_CHILD = 1000 # Tasks per worker process before restart (default: 1000)
16+
17+ # Celery Broker/Backend (Redis example)
18+ # CELERY_BROKER_URL=redis://localhost:6379/0
19+ # CELERY_RESULT_BACKEND=redis://localhost:6379/0
1220
1321# Flask configuration
1422FLASK_ENV = production
Original file line number Diff line number Diff line change 3535 timezone = 'UTC' ,
3636 enable_utc = True ,
3737 task_track_started = True ,
38- task_time_limit = 300 , # 5 minutes max
39- worker_prefetch_multiplier = 1 , # Process one task at a time
40- worker_max_tasks_per_child = 1000 , # Restart worker after 1000 tasks
38+ # Read settings from environment variables with defaults
39+ task_time_limit = int (os .getenv ('CELERY_TASK_TIME_LIMIT' , '300' )), # 5 minutes max
40+ worker_prefetch_multiplier = int (os .getenv ('CELERY_WORKER_PREFETCH_MULTIPLIER' , '1' )), # Process one task at a time
41+ worker_max_tasks_per_child = int (os .getenv ('CELERY_WORKER_MAX_TASKS_PER_CHILD' , '1000' )), # Restart worker after 1000 tasks
4142)
4243
4344def _get_headers ():
You can’t perform that action at this time.
0 commit comments