Commit 23e249d
committed
fix: fail Redis commands fast instead of hanging the request
With REQUIRE_API_KEY turned off, /price stopped answering at all — no
status, no error, just a timeout. /status kept working, which made it
look like the key change had half-applied.
ioredis queues commands while disconnected by default, so against a host
that no longer resolves every call sits in the offline queue waiting for
a connection that never arrives. The await never settles. That is a hang
rather than a rejection, so the try/catch around getCachedPrice cannot
see it and the fallback to Postgres it exists to trigger never runs.
Nothing new broke here. The hang has been present for as long as Redis
has been gone; the 401 was hiding it, because the auth hook rejected
every request before a handler could reach Redis. Opening the API up
removed the thing that was accidentally protecting it.
enableOfflineQueue: false makes those commands reject immediately, which
is what every caller already assumes: cached reads fall back to the
database, cache writes are best-effort, and x402 metering fails closed
on a request it cannot meter.
Worth noting the shape of this one — a dead dependency that produced no
errors, no logs and no failed requests, only silence, and became visible
solely because an unrelated setting stopped masking it.
Claude-Session: https://claude.ai/code/session_01USgemLt4Rnz4SGB1Srf3GB1 parent b146b21 commit 23e249d
1 file changed
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
7 | 22 | | |
8 | 23 | | |
9 | 24 | | |
| |||
0 commit comments