Commit 3c7c016
committed
Fix: pi-dispatch run must fail fast when Valkey is down, not hang forever
CI caught this as a hang; it is a real UX bug. The CLI enqueue used the same connection opts
as the worker -- maxRetriesPerRequest: null -- so an unreachable Valkey made ioredis retry
FOREVER. `pi-dispatch run` with Valkey down would hang indefinitely with no error. And the
CLI test used port 6399 (my local test port) while CI's Valkey service is on 6379, so in CI
the test's enqueue connected to nothing and hung until the job timed out.
parseConnection now takes { failFast }: for the one-shot CLI producer it sets connectTimeout,
enableOfflineQueue: false, and a retryStrategy that gives up after ~2 tries, so an enqueue
against a down Valkey errors in ~1s with a clear "is it running? (docker compose up)" message.
The long-running WORKER keeps the persistent default -- it should ride out a Valkey restart,
not give up.
Tests corrected: the real-Valkey enqueue now uses VALKEY_TEST_URL (skips without it, matching
the queue integration test), and a new test asserts `run` against a DOWN Valkey returns 1 in
under 15s -- the anti-hang guarantee, verified: it errored in 737ms and the runner exited
cleanly.1 parent d49b8a8 commit 3c7c016
3 files changed
Lines changed: 35 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| |||
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
| 66 | + | |
| 67 | + | |
65 | 68 | | |
66 | | - | |
| 69 | + | |
67 | 70 | | |
68 | 71 | | |
69 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
13 | 19 | | |
14 | 20 | | |
15 | 21 | | |
16 | 22 | | |
17 | 23 | | |
18 | 24 | | |
19 | 25 | | |
20 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
21 | 34 | | |
22 | 35 | | |
23 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
68 | 70 | | |
0 commit comments