improve (but disable) rate limits

This commit is contained in:
Bryan Stitt 2022-09-14 06:41:34 +00:00
parent ed505cdd23
commit ea8f6091f9
4 changed files with 8 additions and 5 deletions

View File

@ -72,7 +72,7 @@ impl RedisRateLimit {
let throttle_key = format!("{}:{}:{}", self.key_prefix, label, period_id);
let mut conn = self.pool.get().await?;
let mut conn = self.pool.get().await.context("throttle")?;
// TODO: at high concurency, i think this is giving errors
// TODO: i'm starting to think that bb8 has a bug

View File

@ -218,13 +218,13 @@ impl Web3ProxyApp {
.unwrap_or(num_workers * 2);
// TODO: what are reasonable timeouts
// TODO: set a wait timeout? maybe somehow just emit a warning if this is long
let redis_pool = RedisConfig::from_url(redis_url)
.builder()?
.create_timeout(Some(Duration::from_secs(2)))
.create_timeout(Some(Duration::from_secs(5)))
.max_size(redis_max_connections)
.recycle_timeout(Some(Duration::from_secs(2)))
.recycle_timeout(Some(Duration::from_secs(5)))
.runtime(Runtime::Tokio1)
.wait_timeout(Some(Duration::from_secs(2)))
.build()?;
// test the pool

View File

@ -170,6 +170,9 @@ impl Web3ProxyApp {
return Ok(RateLimitResult::UnknownKey);
}
// TODO: turn back on rate limiting once our alpha test is complete
return Ok(RateLimitResult::AllowedUser(user_data.user_id));
// user key is valid. now check rate limits
// TODO: this is throwing errors when curve-api hits us with high concurrency. investigate i think its bb8's fault
if let Some(rate_limiter) = &self.frontend_rate_limiter {

View File

@ -287,7 +287,7 @@ impl Web3Connections {
let conn_head_block = if let Some(x) = self.block_hashes.get(connection_head_hash) {
x
} else {
// TODO: why does this happen?!?!
// TODO: why does this happen?!?! seems to only happen with uncled blocks. maybe a check on total difficulty skipped it?
// TODO: maybe we should do get_with?
// TODO: maybe we should just continue. this only seems to happen when an older block is received
warn!(%connection_head_hash, %conn_name, %rpc, "Missing connection_head_block in block_hashes. Fetching now");