improve channel adapter

This commit is contained in:
houseme
2025-05-21 16:44:59 +08:00
parent 1c088546b3
commit 0f22b21c8d
21 changed files with 278 additions and 372 deletions
+23 -23
View File
@@ -3,29 +3,29 @@ use tracing::{error, info, instrument};
#[instrument]
pub(crate) async fn init_event_notifier(notifier_config: Option<String>) {
// Initialize event notifier
if notifier_config.is_some() {
info!("event_config is not empty");
tokio::spawn(async move {
let config = NotifierConfig::event_load_config(notifier_config);
let result = rustfs_event::initialize(&config).await;
if let Err(e) = result {
error!("Failed to initialize event notifier: {}", e);
} else {
info!("Event notifier initialized successfully");
}
});
info!("Initializing event notifier...");
let notifier_config_present = notifier_config.is_some();
let config = if notifier_config_present {
info!("event_config is not empty, path: {:?}", notifier_config);
NotifierConfig::event_load_config(notifier_config)
} else {
info!("event_config is empty");
tokio::spawn(async move {
let config = rustfs_event::get_event_notifier_config();
info!("event_config is {:?}", config);
let result = rustfs_event::initialize(config).await;
if let Err(e) = result {
error!("Failed to initialize event notifier: {}", e);
} else {
info!("Event notifier initialized successfully");
}
});
}
rustfs_event::get_event_notifier_config().clone()
};
info!("using event_config: {:?}", config);
tokio::spawn(async move {
let result = rustfs_event::initialize(&config).await;
match result {
Ok(_) => info!(
"event notifier initialized successfully {}",
if notifier_config_present {
"by config file"
} else {
"by sys config"
}
),
Err(e) => error!("Failed to initialize event notifier: {}", e),
}
});
}
+2
View File
@@ -506,8 +506,10 @@ async fn run(opt: config::Opt) -> Result<()> {
})?;
ecconfig::init();
// config system configuration
GLOBAL_ConfigSys.init(store.clone()).await?;
// event system configuration
GLOBAL_EventSys.init(store.clone()).await?;
// Initialize event notifier
+1 -1
View File
@@ -1,5 +1,5 @@
pub mod access;
pub mod ecfs;
pub mod error;
mod event_notifier;
mod event;
pub mod options;