Remove mutation from default_config and set default log_level to off
This commit is contained in:
parent
7a388f4d72
commit
92571d961f
3 changed files with 20 additions and 19 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -317,6 +317,7 @@ dependencies = [
|
||||||
"image",
|
"image",
|
||||||
"jsonwebtoken",
|
"jsonwebtoken",
|
||||||
"lru-cache",
|
"lru-cache",
|
||||||
|
"maplit",
|
||||||
"num_cpus",
|
"num_cpus",
|
||||||
"opentelemetry",
|
"opentelemetry",
|
||||||
"opentelemetry-jaeger",
|
"opentelemetry-jaeger",
|
||||||
|
|
|
@ -84,6 +84,7 @@ hmac = "0.11.0"
|
||||||
sha-1 = "0.9.8"
|
sha-1 = "0.9.8"
|
||||||
# used for conduit's CLI and admin room command parsing
|
# used for conduit's CLI and admin room command parsing
|
||||||
clap = { version = "3.0.10", default-features = false, features = ["std", "derive"] }
|
clap = { version = "3.0.10", default-features = false, features = ["std", "derive"] }
|
||||||
|
maplit = "1.0.2"
|
||||||
|
|
||||||
[target.'cfg(not(target_env = "msvc"))'.dependencies]
|
[target.'cfg(not(target_env = "msvc"))'.dependencies]
|
||||||
tikv-jemalloc-ctl = { version = "0.4.2", features = ['use_std'] }
|
tikv-jemalloc-ctl = { version = "0.4.2", features = ['use_std'] }
|
||||||
|
|
37
src/main.rs
37
src/main.rs
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use maplit::hashset;
|
||||||
use opentelemetry::trace::{FutureExt, Tracer};
|
use opentelemetry::trace::{FutureExt, Tracer};
|
||||||
use rocket::{
|
use rocket::{
|
||||||
catch, catchers,
|
catch, catchers,
|
||||||
|
@ -292,28 +293,26 @@ fn bad_json_catcher() -> Result<()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn default_config() -> rocket::Config {
|
fn default_config() -> rocket::Config {
|
||||||
let mut config = rocket::Config::release_default();
|
use rocket::config::{LogLevel, Shutdown, Sig};
|
||||||
|
|
||||||
{
|
rocket::Config {
|
||||||
let mut shutdown = &mut config.shutdown;
|
// Disable rocket's logging to get only tracing-subscriber's log output
|
||||||
|
log_level: LogLevel::Off,
|
||||||
|
shutdown: Shutdown {
|
||||||
|
// Once shutdown is triggered, this is the amount of seconds before rocket
|
||||||
|
// will forcefully start shutting down connections, this gives enough time to /sync
|
||||||
|
// requests and the like (which havent gotten the memo, somehow) to still complete gracefully.
|
||||||
|
grace: 35,
|
||||||
|
|
||||||
#[cfg(unix)]
|
// After the grace period, rocket starts shutting down connections, and waits at least this
|
||||||
{
|
// many seconds before forcefully shutting all of them down.
|
||||||
use rocket::config::Sig;
|
mercy: 10,
|
||||||
|
|
||||||
shutdown.signals.insert(Sig::Term);
|
#[cfg(unix)]
|
||||||
shutdown.signals.insert(Sig::Int);
|
signals: hashset![Sig::Term, Sig::Int],
|
||||||
}
|
|
||||||
|
|
||||||
// Once shutdown is triggered, this is the amount of seconds before rocket
|
..Shutdown::default()
|
||||||
// will forcefully start shutting down connections, this gives enough time to /sync
|
},
|
||||||
// requests and the like (which havent gotten the memo, somehow) to still complete gracefully.
|
..rocket::Config::release_default()
|
||||||
shutdown.grace = 35;
|
|
||||||
|
|
||||||
// After the grace period, rocket starts shutting down connections, and waits at least this
|
|
||||||
// many seconds before forcefully shutting all of them down.
|
|
||||||
shutdown.mercy = 10;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
config
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue