Don't log errors on main (#7289)

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin 2024-02-02 19:24:49 -07:00 committed by GitHub
parent f09da1a1c8
commit fcbc220408
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 6 deletions

View file

@ -145,11 +145,14 @@ const FLUSH_INTERVAL: Duration = Duration::from_secs(1);
#[cfg(not(debug_assertions))]
const FLUSH_INTERVAL: Duration = Duration::from_secs(60 * 5);
static ZED_CLIENT_CHECKSUM_SEED: Lazy<Vec<u8>> = Lazy::new(|| {
static ZED_CLIENT_CHECKSUM_SEED: Lazy<Option<Vec<u8>>> = Lazy::new(|| {
option_env!("ZED_CLIENT_CHECKSUM_SEED")
.unwrap_or("development-checksum-seed")
.as_bytes()
.into()
.map(|s| s.as_bytes().into())
.or_else(|| {
env::var("ZED_CLIENT_CHECKSUM_SEED")
.ok()
.map(|s| s.as_bytes().into())
})
});
impl Telemetry {
@ -510,6 +513,10 @@ impl Telemetry {
return;
}
let Some(checksum_seed) = &*ZED_CLIENT_CHECKSUM_SEED else {
return;
};
let this = self.clone();
self.executor
.spawn(
@ -551,9 +558,9 @@ impl Telemetry {
}
let mut summer = Sha256::new();
summer.update(&*ZED_CLIENT_CHECKSUM_SEED);
summer.update(checksum_seed);
summer.update(&json_bytes);
summer.update(&*ZED_CLIENT_CHECKSUM_SEED);
summer.update(checksum_seed);
let mut checksum = String::new();
for byte in summer.finalize().as_slice() {
use std::fmt::Write;

View file

@ -142,6 +142,7 @@ setTimeout(() => {
ZED_RPC_URL: "http://localhost:8080/rpc",
ZED_ADMIN_API_TOKEN: "secret",
ZED_WINDOW_SIZE: size,
ZED_CLIENT_CHECKSUM_SEED: "development-checksum-seed",
PATH: process.env.PATH,
RUST_LOG: process.env.RUST_LOG || "info",
},