diff options
author | Colin Reeder <vpzomtrrfrt@gmail.com> | 2020-10-12 22:03:29 -0600 |
---|---|---|
committer | Colin Reeder <vpzomtrrfrt@gmail.com> | 2020-10-12 22:03:29 -0600 |
commit | eb570ccfee42c1b0e10bc2b6d2e022bf2eba2be8 (patch) | |
tree | f5f734a7b904adf3a7f17ba397963830893f92d9 | |
parent | a2b6f6705df89e82c1160890c8e900914d622860 (diff) |
Remove logging from ratelimit, increase rate to a more reasonable number
-rw-r--r-- | src/main.rs | 2 | ||||
-rw-r--r-- | src/ratelimit.rs | 4 |
2 files changed, 1 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs index 3c4e7a9..250a463 100644 --- a/src/main.rs +++ b/src/main.rs @@ -937,7 +937,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { host_url_apub, http_client: hyper::Client::builder().build(hyper_tls::HttpsConnector::new()), apub_proxy_rewrites, - api_ratelimit: ratelimit::RatelimitBucket::new(1), + api_ratelimit: ratelimit::RatelimitBucket::new(300), }); let worker_trigger = worker::start_worker(base_context.clone()); diff --git a/src/ratelimit.rs b/src/ratelimit.rs index 803c4bd..93d7887 100644 --- a/src/ratelimit.rs +++ b/src/ratelimit.rs @@ -22,7 +22,6 @@ impl<K: Eq + std::hash::Hash + std::fmt::Debug> RatelimitBucket<K> { let inner = self.inner.read().await; let seconds_into = now.duration_since(inner.divider_time).as_secs(); if seconds_into >= 60 { - println!("new minute"); std::mem::drop(inner); let mut inner = self.inner.write().await; @@ -53,7 +52,6 @@ impl<K: Eq + std::hash::Hash + std::fmt::Debug> RatelimitBucket<K> { } async fn try_for_current(&self, seconds_into: u64, inner: &Inner<K>, key: K) -> bool { - println!("key={:?}", key); let prev_count = if let Some(last_minute) = &inner.last_minute { if let Some(prev_count) = last_minute.get(&key) { (u64::from(prev_count.load(std::sync::atomic::Ordering::Relaxed)) @@ -73,8 +71,6 @@ impl<K: Eq + std::hash::Hash + std::fmt::Debug> RatelimitBucket<K> { .or_default() .fetch_add(1, std::sync::atomic::Ordering::SeqCst); - println!("count={:?}", count); - count < self.cap } } |