Commit 4743aff
authored
Improve Redis/Celery reliability to prevent task loss (#1853)
- Add visibility_timeout (12h) to prevent tasks from being redelivered
while still running
- Enable task_acks_late and task_reject_on_worker_lost to ensure tasks
are requeued if a worker crashes
- Set worker_prefetch_multiplier=1 to prevent task hoarding
- Add broker_heartbeat for faster connection problem detection
- Configure socket timeouts and retry_on_timeout for Redis connections
- Add exponential backoff retry (3 retries) for Redis client
- Add health_check_interval for periodic connection validation
- Add configurable task time limits (24h hard, 23h soft)
- Fix task_track_started from tuple (True,) to boolean True
New environment variables for configuration:
- CELERY_VISIBILITY_TIMEOUT, CELERY_BROKER_HEARTBEAT
- CELERY_TASK_TIME_LIMIT, CELERY_TASK_SOFT_TIME_LIMIT
- CELERY_BROKER_POOL_LIMIT, CELERY_REDIS_MAX_CONNECTIONS
- REDIS_SOCKET_TIMEOUT, REDIS_SOCKET_CONNECT_TIMEOUT
- REDIS_HEALTH_CHECK_INTERVAL
AI-assisted: Claude Code
Signed-off-by: Christian Berendt <[email protected]>1 parent 6e1e262 commit 4743aff
3 files changed
+65
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | | - | |
25 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
26 | 75 | | |
27 | 76 | | |
28 | | - | |
| 77 | + | |
29 | 78 | | |
30 | 79 | | |
31 | 80 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
188 | 190 | | |
189 | 191 | | |
190 | 192 | | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
191 | 196 | | |
192 | 197 | | |
193 | 198 | | |
194 | 199 | | |
195 | 200 | | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
196 | 206 | | |
197 | 207 | | |
198 | 208 | | |
| |||
0 commit comments