period instead of minute in variable names

This commit is contained in:
Bryan Stitt 2022-11-01 19:24:29 +00:00
parent bb9e4f99ef
commit f859ed56fc
7 changed files with 12 additions and 11 deletions

7
Cargo.lock generated
View File

@ -2698,9 +2698,9 @@ dependencies = [
[[package]]
name = "moka"
version = "0.9.4"
version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd8256cf9fa396576521e5e94affadb95818ec48f5dbedca36714387688aea29"
checksum = "e013c8176e5aae43f4c0a982733c44feebddc4e7ac0871a109a9655e668487af"
dependencies = [
"async-io",
"async-lock",
@ -2711,6 +2711,7 @@ dependencies = [
"num_cpus",
"once_cell",
"parking_lot 0.12.1",
"rustc_version",
"scheduled-thread-pool",
"skeptic",
"smallvec",
@ -5527,7 +5528,7 @@ dependencies = [
[[package]]
name = "web3_proxy"
version = "0.6.0"
version = "0.8.0"
dependencies = [
"anyhow",
"arc-swap",

View File

@ -18,12 +18,12 @@ redirect_user_url = "https://llamanodes.com/user-rpc-stats/{{user_id}}"
# 0 = block all public requests
public_max_concurrent_requests = 5
# 0 = block all public requests
public_requests_per_minute = 0
public_requests_per_period = 0
# 1GB of cache
response_cache_max_bytes = 10_000_000_000
[app.allowed_origin_requests_per_minute]
[app.allowed_origin_requests_per_period]
"https://chainlist.org" = 1_000
[balanced_rpcs]

View File

@ -9,6 +9,6 @@ redis-rate-limiter = { path = "../redis-rate-limiter" }
anyhow = "1.0.66"
hashbrown = "0.12.3"
moka = { version = "0.9.4", default-features = false, features = ["future"] }
moka = { version = "0.9.5", default-features = false, features = ["future"] }
tokio = "1.21.2"
tracing = "0.1.37"

View File

@ -77,7 +77,6 @@ where
let redis_key = format!("{}:{}", self.prefix, key);
// TODO: DO NOT UNWRAP HERE. figure out how to handle anyhow error being wrapped in an Arc
// TODO: i'm sure this could be a lot better. but race conditions make this hard to think through. brain needs sleep
let local_key_count: Arc<AtomicU64> = {
// clone things outside of the `async move`

View File

@ -1,6 +1,6 @@
[package]
name = "web3_proxy"
version = "0.6.0"
version = "0.8.0"
edition = "2021"
default-run = "web3_proxy"
@ -39,7 +39,7 @@ hdrhistogram = "7.5.2"
http = "0.2.8"
ipnet = "2.5.0"
metered = { version = "0.9.0", features = ["serialize"] }
moka = { version = "0.9.4", default-features = false, features = ["future"] }
moka = { version = "0.9.5", default-features = false, features = ["future"] }
notify = "5.0.0"
num = "0.4.0"
# TODO: import num_traits from sea-orm so we always have the same version

View File

@ -348,9 +348,10 @@ impl StatEmitter {
debug_assert_eq!(stat.period_seconds, self.period_seconds);
// get the user cache for the current period
// TODO: i don't think this works right. maybe do DashMap entry api as the outer variable
let user_cache = self
.aggregated_proxy_responses
.get_with(stat.period_timestamp, async move {
.get_with_by_ref(&stat.period_timestamp, async move {
CacheBuilder::default()
.build_with_hasher(hashbrown::hash_map::DefaultHashBuilder::new())
})

View File

@ -384,7 +384,7 @@ impl Web3Connection {
// if we already have this block saved, set new_head_block to that arc. otherwise store this copy
new_head_block = block_map
.get_with(new_hash, async move { new_head_block })
.get_with_by_ref(&new_hash, async move { new_head_block })
.await;
let new_num = new_head_block.number.unwrap_or_default();