1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-03 02:03:53 +00:00

only call global subscribe once

This commit is contained in:
neuronull
2025-10-17 09:10:29 -06:00
parent 6a7b40eace
commit 24d8a34d29

View File

@@ -2,7 +2,7 @@
use std::{
collections::HashMap,
sync::{atomic::AtomicU32, Arc, Mutex},
sync::{atomic::AtomicU32, Arc, Mutex, Once},
time::Instant,
};
@@ -26,6 +26,8 @@ use assertion::{
};
use registration::{PasskeyRegistrationRequest, PreparePasskeyRegistrationCallback};
static INIT: Once = Once::new();
#[derive(uniffi::Enum, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum UserVerification {
@@ -70,18 +72,20 @@ impl MacOSProviderClient {
#[allow(clippy::unwrap_used)]
#[uniffi::constructor]
pub fn connect() -> Self {
let filter = EnvFilter::builder()
// Everything logs at `INFO`
.with_default_directive(LevelFilter::INFO.into())
.from_env_lossy();
INIT.call_once(|| {
let filter = EnvFilter::builder()
// Everything logs at `INFO`
.with_default_directive(LevelFilter::INFO.into())
.from_env_lossy();
tracing_subscriber::registry()
.with(filter)
.with(tracing_oslog::OsLogger::new(
"com.bitwarden.desktop.autofill-extension",
"default",
))
.init();
tracing_subscriber::registry()
.with(filter)
.with(tracing_oslog::OsLogger::new(
"com.bitwarden.desktop.autofill-extension",
"default",
))
.init();
});
let (from_server_send, mut from_server_recv) = tokio::sync::mpsc::channel(32);
let (to_server_send, to_server_recv) = tokio::sync::mpsc::channel(32);