disable redis rate limits
This commit is contained in:
parent
e4d25b207d
commit
5eef5173a1
@ -127,7 +127,10 @@ fn main() -> anyhow::Result<()> {
|
|||||||
// if RUST_LOG isn't set, configure a default
|
// if RUST_LOG isn't set, configure a default
|
||||||
// TODO: is there a better way to do this?
|
// TODO: is there a better way to do this?
|
||||||
if std::env::var("RUST_LOG").is_err() {
|
if std::env::var("RUST_LOG").is_err() {
|
||||||
std::env::set_var("RUST_LOG", "info,redis_rate_limit=debug,web3_proxy=debug");
|
std::env::set_var(
|
||||||
|
"RUST_LOG",
|
||||||
|
"info,ethers=debug,redis_rate_limit=debug,web3_proxy=debug",
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// install global collector configured based on RUST_LOG env var.
|
// install global collector configured based on RUST_LOG env var.
|
||||||
|
@ -226,7 +226,7 @@ impl Web3ProxyApp {
|
|||||||
.context("no user data")?
|
.context("no user data")?
|
||||||
} else {
|
} else {
|
||||||
// unwrap the cache's result
|
// unwrap the cache's result
|
||||||
user_data.context("no user data")?
|
user_data.expect("we just checked the user_data is_none above")
|
||||||
};
|
};
|
||||||
|
|
||||||
if user_data.user_id == 0 {
|
if user_data.user_id == 0 {
|
||||||
@ -234,6 +234,8 @@ impl Web3ProxyApp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// user key is valid. now check rate limits
|
// user key is valid. now check rate limits
|
||||||
|
// TODO: this is throwing errors when curve-api hits us with high concurrency. investigate
|
||||||
|
if false {
|
||||||
if let Some(rate_limiter) = &self.rate_limiter {
|
if let Some(rate_limiter) = &self.rate_limiter {
|
||||||
// TODO: query redis in the background so that users don't have to wait on this network request
|
// TODO: query redis in the background so that users don't have to wait on this network request
|
||||||
// TODO: better key? have a prefix so its easy to delete all of these
|
// TODO: better key? have a prefix so its easy to delete all of these
|
||||||
@ -275,6 +277,7 @@ impl Web3ProxyApp {
|
|||||||
// TODO: if no redis, rate limit with a local cache?
|
// TODO: if no redis, rate limit with a local cache?
|
||||||
todo!("no redis. cannot rate limit")
|
todo!("no redis. cannot rate limit")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Ok(RateLimitResult::AllowedUser(user_data.user_id))
|
Ok(RateLimitResult::AllowedUser(user_data.user_id))
|
||||||
}
|
}
|
||||||
|
@ -186,6 +186,7 @@ impl fmt::Debug for JsonRpcForwardedResponse {
|
|||||||
impl JsonRpcForwardedResponse {
|
impl JsonRpcForwardedResponse {
|
||||||
pub fn from_anyhow_error(err: anyhow::Error, id: Box<RawValue>) -> Self {
|
pub fn from_anyhow_error(err: anyhow::Error, id: Box<RawValue>) -> Self {
|
||||||
// TODO: this is too verbose. plenty of errors are valid, like users giving an invalid address. no need to log that
|
// TODO: this is too verbose. plenty of errors are valid, like users giving an invalid address. no need to log that
|
||||||
|
// TODO: can we somehow get the initial request here? if we put that into a tracing span, will things slow down a ton?
|
||||||
warn!(?err, "forwarding error");
|
warn!(?err, "forwarding error");
|
||||||
|
|
||||||
JsonRpcForwardedResponse {
|
JsonRpcForwardedResponse {
|
||||||
|
@ -4,6 +4,7 @@ use std::fmt;
|
|||||||
use std::sync::atomic;
|
use std::sync::atomic;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use tokio::time::{sleep, Duration, Instant};
|
use tokio::time::{sleep, Duration, Instant};
|
||||||
|
use tracing::debug;
|
||||||
use tracing::warn;
|
use tracing::warn;
|
||||||
use tracing::{instrument, trace};
|
use tracing::{instrument, trace};
|
||||||
|
|
||||||
@ -57,7 +58,7 @@ impl OpenRequestHandle {
|
|||||||
// TODO: use tracing spans properly
|
// TODO: use tracing spans properly
|
||||||
// TODO: requests from customers have request ids, but we should add
|
// TODO: requests from customers have request ids, but we should add
|
||||||
// TODO: including params in this is way too verbose
|
// TODO: including params in this is way too verbose
|
||||||
trace!("Sending {} to {}", method, self.0);
|
debug!("Sending {} to {}", method, self.0);
|
||||||
|
|
||||||
let mut provider = None;
|
let mut provider = None;
|
||||||
|
|
||||||
@ -80,8 +81,8 @@ impl OpenRequestHandle {
|
|||||||
|
|
||||||
// TODO: i think ethers already has trace logging (and does it much more fancy)
|
// TODO: i think ethers already has trace logging (and does it much more fancy)
|
||||||
// TODO: at least instrument this with more useful information
|
// TODO: at least instrument this with more useful information
|
||||||
// trace!("Reply from {}: {:?}", self.0, response);
|
trace!("Reply from {} for {}: {:?}", self.0, method, response);
|
||||||
trace!("Reply from {}", self.0);
|
// trace!("Reply from {}", self.0);
|
||||||
|
|
||||||
response
|
response
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user