Commit 51d44fb
committed
fix(vehicle): handle :too_many_request in list_vehicles! and fetch_strict
Testing the previous commit against a live EXCEEDED_LIMIT ban surfaced
two spots where {:error, :too_many_request, retry_after} was never
handled, even though this shape already existed for plain HTTP 429s:
- Vehicles.list_vehicles!/0 (called once at application boot) had no
matching case clause, so a rate-limited "list vehicles" call crashed
the whole application at startup - and with restart: always, that's
a boot-crash-loop that keeps calling the rate-limited endpoint.
- Vehicle.fetch_strict/2 (used by the manual "suspend logging" action)
had the same gap, which would crash that vehicle's process if
triggered while rate-limited.
Both now fall back gracefully instead of crashing: list_vehicles! uses
its existing fallback_vehicles() (cached cars from the DB), and
fetch_strict returns {:error, {:too_many_request, retry_after}} in the
same {:error, reason} shape its one caller already expects.1 parent 45b82f7 commit 51d44fb
2 files changed
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
86 | 90 | | |
87 | 91 | | |
88 | 92 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1558 | 1558 | | |
1559 | 1559 | | |
1560 | 1560 | | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
1561 | 1564 | | |
1562 | 1565 | | |
1563 | 1566 | | |
| |||
0 commit comments