Skip to content

Commit b6252a0

Browse files
Preslav LeConvex, Inc.
Preslav Le
authored and
Convex, Inc.
committed
Turn MAX_PUSH_BYTES into a knob. (#24162)
GitOrigin-RevId: 6f10f889ca70ba97a7e818af99fa951d563b8e56
1 parent ef27da0 commit b6252a0

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

Diff for: crates/common/src/knobs.rs

+5
Original file line numberDiff line numberDiff line change
@@ -972,3 +972,8 @@ pub static ALLOW_STORAGE_GET_VIA_DOCUMENT_ID: LazyLock<bool> =
972972
/// See https://docs.rs/tower-http/0.5.0/tower_http/timeout/struct.TimeoutLayer.html
973973
pub static HTTP_SERVER_TIMEOUT_DURATION: LazyLock<Duration> =
974974
LazyLock::new(|| Duration::from_secs(env_config("HTTP_SERVER_TIMEOUT_SECONDS", 300)));
975+
976+
/// The limit on the request size to /push_config.
977+
// Schema and code bundle pushes must be less than this.
978+
pub static MAX_PUSH_BYTES: LazyLock<usize> =
979+
LazyLock::new(|| env_config("MAX_PUSH_BYTES", 100_000_000));

Diff for: crates/local_backend/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ pub mod subs;
8888
mod test_helpers;
8989

9090
pub const MAX_CONCURRENT_REQUESTS: usize = 128;
91-
// Schema and code bundle pushes must be less than this in 100MB
92-
pub const MAX_PUSH_BYTES: usize = 100_000_000;
9391

9492
pub struct LocalAppState {
9593
// Origin for the server (e.g. http://127.0.0.1:3210, https://demo.convex.cloud)

Diff for: crates/local_backend/src/router.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use common::{
1818
knobs::{
1919
MAX_BACKEND_ACTION_CALLBACKS_REQUEST_SIZE,
2020
MAX_BACKEND_PUBLIC_API_REQUEST_SIZE,
21+
MAX_PUSH_BYTES,
2122
},
2223
};
2324
use http::{
@@ -109,7 +110,6 @@ use crate::{
109110
sync_client_version_url,
110111
},
111112
LocalAppState,
112-
MAX_PUSH_BYTES,
113113
};
114114

115115
pub async fn router(st: LocalAppState) -> Router {
@@ -142,7 +142,7 @@ pub async fn router(st: LocalAppState) -> Router {
142142
StatusCode::INTERNAL_SERVER_ERROR
143143
}))
144144
.layer(RequestDecompressionLayer::new())
145-
.layer(DefaultBodyLimit::max(MAX_PUSH_BYTES)),
145+
.layer(DefaultBodyLimit::max(*MAX_PUSH_BYTES)),
146146
)
147147
.route("/get_config", post(get_config))
148148
.route("/get_config_hashes", post(get_config_hashes))

0 commit comments

Comments
 (0)