Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d607869

Browse files
authored
Fix --serve-web <file> (#10382)
1 parent 980271a commit d607869

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

crates/top/rerun/src/commands/entrypoint.rs

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,14 @@ Example: `16GB` or `50%` (of system total)."
117117

118118
#[clap(
119119
long,
120-
default_value = "0B",
120+
default_value = None,
121121
long_help = r"An upper limit on how much memory the gRPC server (`--serve-web`) should use.
122122
The server buffers log messages for the benefit of late-arriving viewers.
123123
When this limit is reached, Rerun will drop the oldest data.
124-
Example: `16GB` or `50%` (of system total)."
124+
Example: `16GB` or `50%` (of system total).
125+
Default is `0B`, or `25%` if any of the `--serve-*` flags are set."
125126
)]
126-
server_memory_limit: String,
127+
server_memory_limit: Option<String>,
127128

128129
#[clap(
129130
long,
@@ -163,13 +164,17 @@ When persisted, the state will be stored at the following locations:
163164
///
164165
/// The server will act like a proxy, listening for incoming connections from
165166
/// logging SDKs, and forwarding it to Rerun viewers.
167+
///
168+
/// Using this sets the default `--server-memory-limit` to 25% of available system memory.
166169
#[clap(long)]
167170
serve_web: bool,
168171

169172
/// This will host a gRPC server.
170173
///
171174
/// The server will act like a proxy, listening for incoming connections from
172175
/// logging SDKs, and forwarding it to Rerun viewers.
176+
///
177+
/// Using this sets the default `--server-memory-limit` to 25% of available system memory.
173178
#[clap(long)]
174179
serve_grpc: bool,
175180

@@ -720,7 +725,19 @@ fn run_impl(
720725
#[cfg(feature = "server")]
721726
let server_memory_limit = {
722727
re_log::debug!("Parsing memory limit for gRPC server");
723-
re_memory::MemoryLimit::parse(&args.server_memory_limit)
728+
let value = match &args.server_memory_limit {
729+
Some(v) => v.as_str(),
730+
None => {
731+
// When spawning just a server, we don't want the memory limit to be 0.
732+
if args.serve || args.serve_web || args.serve_grpc {
733+
"25%"
734+
} else {
735+
"0B"
736+
}
737+
}
738+
};
739+
re_log::debug!("Server memory limit: {value}");
740+
re_memory::MemoryLimit::parse(value)
724741
.map_err(|err| anyhow::format_err!("Bad --server-memory-limit: {err}"))?
725742
};
726743

0 commit comments

Comments
 (0)