Skip to content

Commit 2a77804

Browse files
committed
chore: tweak rate limits
1 parent 316ca51 commit 2a77804

File tree

6 files changed

+48
-46
lines changed
  • cloud/packages/ci-runner
  • packages
    • common
      • api-helper/build/src
      • chirp-workflow/core/src/db/fdb_sqlite_nats
    • core/services/cluster/src/workflows/server/install/install_scripts/components
    • edge

6 files changed

+48
-46
lines changed

cloud/packages/ci-runner/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM alpine:latest AS builder
22

33
# FROM gcr.io/kaniko-project/executor:latest
4-
FROM ghcr.io/rivet-gg/executor@sha256:439d4dbb0f3f8c1c6c2195e144d29195b4930b87166a6fae32061b564a6baa9e
4+
FROM ghcr.io/rivet-dev/executor@sha256:439d4dbb0f3f8c1c6c2195e144d29195b4930b87166a6fae32061b564a6baa9e
55
COPY --from=builder /bin/sh /bin/sh
66
COPY --from=builder /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1
77

packages/common/api-helper/build/src/util.rs

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -289,43 +289,43 @@ pub async fn basic_rate_limit(
289289
config: &rivet_config::Config,
290290
rate_limit_ctx: crate::auth::AuthRateLimitCtx<'_>,
291291
) -> GlobalResult<()> {
292-
if let Some(remote_address) = rate_limit_ctx.remote_address {
293-
let rate_limit_config = rate_limit_ctx.rate_limit_config;
294-
295-
// Trigger rate limit
296-
let rate_limit_key = rate_limit_config.key.to_owned();
297-
let rate_limit_results = rate_limit_ctx
298-
.cache
299-
.rate_limit(
300-
&("req", rate_limit_config.key.to_owned()),
301-
&remote_address.to_string(),
302-
rate_limit_config,
303-
)
304-
.await;
305-
306-
// Decode bypass token
307-
if let Some(bypass_token) = rate_limit_ctx.bypass_token {
308-
as_auth_expired(rivet_claims::decode(
309-
&config.server()?.jwt.public,
310-
&bypass_token,
311-
)?)?
312-
.as_bypass()?;
313-
}
314-
// Handle rate limiting
315-
else if let Some(rate_limit_result) = rate_limit_results.iter().find(|res| !res.is_valid)
316-
{
317-
tracing::info!(
318-
?remote_address,
319-
?rate_limit_key,
320-
result=%rate_limit_result,
321-
"too many requests"
322-
);
323-
324-
return Err(err_code!(API_RATE_LIMIT {
325-
metadata: rate_limit_result.retry_after_ts(),
326-
}));
327-
}
328-
}
292+
// if let Some(remote_address) = rate_limit_ctx.remote_address {
293+
// let rate_limit_config = rate_limit_ctx.rate_limit_config;
294+
//
295+
// // Trigger rate limit
296+
// let rate_limit_key = rate_limit_config.key.to_owned();
297+
// let rate_limit_results = rate_limit_ctx
298+
// .cache
299+
// .rate_limit(
300+
// &("req", rate_limit_config.key.to_owned()),
301+
// &remote_address.to_string(),
302+
// rate_limit_config,
303+
// )
304+
// .await;
305+
//
306+
// // Decode bypass token
307+
// if let Some(bypass_token) = rate_limit_ctx.bypass_token {
308+
// as_auth_expired(rivet_claims::decode(
309+
// &config.server()?.jwt.public,
310+
// &bypass_token,
311+
// )?)?
312+
// .as_bypass()?;
313+
// }
314+
// // Handle rate limiting
315+
// else if let Some(rate_limit_result) = rate_limit_results.iter().find(|res| !res.is_valid)
316+
// {
317+
// tracing::info!(
318+
// ?remote_address,
319+
// ?rate_limit_key,
320+
// result=%rate_limit_result,
321+
// "too many requests"
322+
// );
323+
//
324+
// return Err(err_code!(API_RATE_LIMIT {
325+
// metadata: rate_limit_result.retry_after_ts(),
326+
// }));
327+
// }
328+
// }
329329

330330
Ok(())
331331
}

packages/common/chirp-workflow/core/src/db/fdb_sqlite_nats/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,8 @@ impl Database for DatabaseFdbSqliteNats {
369369

370370
#[tracing::instrument(skip_all)]
371371
async fn publish_metrics(&self, _worker_instance_id: Uuid) -> WorkflowResult<()> {
372+
return Ok(());
373+
372374
// Attempt to be the only worker publishing metrics by writing to the lock key
373375
let acquired_lock = self
374376
.pools

packages/core/services/cluster/src/workflows/server/install/install_scripts/components/traffic_server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use include_dir::{include_dir, Dir};
33

44
use super::s3;
55

6-
const TRAFFIC_SERVER_IMAGE: &str = "ghcr.io/rivet-gg/apache-traffic-server:9934dc2";
6+
const TRAFFIC_SERVER_IMAGE: &str = "ghcr.io/rivet-dev/apache-traffic-server:9934dc2";
77

88
pub fn install() -> String {
99
include_str!("../files/traffic_server_install.sh").replace("__IMAGE__", TRAFFIC_SERVER_IMAGE)

packages/edge/api/actor/src/route/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ define_router! {
5050
opt_auth: true,
5151
rate_limit: {
5252
buckets: [
53-
{ count: 10_000, bucket: duration::minutes(1) },
53+
{ count: 10_000_000, bucket: duration::minutes(1) },
5454
],
5555
},
5656
),
@@ -60,7 +60,7 @@ define_router! {
6060
opt_auth: true,
6161
rate_limit: {
6262
buckets: [
63-
{ count: 10_000, bucket: duration::minutes(1) },
63+
{ count: 10_000_000, bucket: duration::minutes(1) },
6464
],
6565
},
6666
),
@@ -73,7 +73,7 @@ define_router! {
7373
opt_auth: true,
7474
rate_limit: {
7575
buckets: [
76-
{ count: 10_000, bucket: duration::minutes(1) },
76+
{ count: 10_000_000, bucket: duration::minutes(1) },
7777
],
7878
},
7979
),
@@ -95,7 +95,7 @@ define_router! {
9595
opt_auth: true,
9696
rate_limit: {
9797
buckets: [
98-
{ count: 10_000, bucket: duration::minutes(1) },
98+
{ count: 10_000_000, bucket: duration::minutes(1) },
9999
],
100100
},
101101
),
@@ -108,7 +108,7 @@ define_router! {
108108
opt_auth: true,
109109
rate_limit: {
110110
buckets: [
111-
{ count: 10_000, bucket: duration::minutes(1) },
111+
{ count: 10_000_000, bucket: duration::minutes(1) },
112112
],
113113
},
114114
),

packages/edge/infra/guard/server/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,11 @@ fn create_middleware_function(
128128
// This could be fetched from a database in a real implementation
129129
Ok(MiddlewareResponse::Ok(MiddlewareConfig {
130130
rate_limit: RateLimitConfig {
131-
requests: 100, // 100 requests
131+
requests: 100_000, // 100 requests
132132
period: 60, // per 60 seconds
133133
},
134134
max_in_flight: MaxInFlightConfig {
135-
amount: 20, // 20 concurrent requests
135+
amount: 20_000, // 20 concurrent requests
136136
},
137137
retry: RetryConfig {
138138
max_attempts: 7,

0 commit comments

Comments
 (0)