jup-ag / jupiter-swap-api

The jupiter swap api binary
90 stars 22 forks source link

Panic when receiving 429 Too Many Requests from RPC #33

Closed zezic closed 3 months ago

zezic commented 3 months ago

When running jupiter-swap-api with Helius RPC node it crashes with the following log:

...
2024-07-26T07:07:42.045709Z  INFO jupiter_core::address_lookup_table_cache: Fetching 13049 address lookup tables    
2024-07-26T07:07:45.720213Z  INFO jupiter_core::address_lookup_table_cache: Update 13049 ALTs into the AddressLookupTableCache in 3.67468405s    
2024-07-26T07:07:45.720232Z  INFO jupiter_core::router: 122809 amms for 122809 lookup tables    
thread 'main' panicked at jupiter-swap-api/src/main.rs:832:62:
called `Result::unwrap()` on an `Err` value: HTTP status client error (429 Too Many Requests) for url (https://mainnet.helius-rpc.com/?api-key=*api_key_hidden*)

Caused by:
    HTTP status client error (429 Too Many Requests) for url (https://mainnet.helius-rpc.com/?api-key=*api_key_hidden*)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Aborted (core dumped)

Is it possible to handle the HTTP status 429 in jupiter-swap-api? We can't run it in self-hosted scenario because of such behavior, but at the same time we also can't use public Jupiter swap API because it's overloaded.

lonely1215225 commented 3 months ago

me too ,i use quicknode ,grade plan

siong1987 commented 3 months ago

there is no way to recover if the RPC 429. it is best to panic.

Serdnad commented 1 month ago

@siong1987 if there's no way to recover from a 429 response (which I'm quite curious to hear more about, but), would it be possible to support setting a rate limit to throttle requests to?

Maybe the answer is I just don't meet the requirements for self-hosting anymore, but this has only recently become a recurring issue for me, with the instance hitting spurts of several hundred requests per second, at least trying to startup.