This service is a bit of a mess and needs a proper overhaul.
-
The readability of the core fallback logic is terrible. It should be broken into modules and completely refactored while preserving the same behavior.
-
Despite the very simple route structure, we should use the oak framework for routing, rate limiting middleware, and request processing.
-
Add tests for the following scenarios:
- First RPC successful (normal)
- First RPC fails, second successful (returns 2nd res)
- First RPC hangs, second successful (returns 2nd res)
- All RPCs fail (returns status and body of last request)