mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-13 16:46:55 +00:00
improve channel adapter
This commit is contained in:
+23
-23
@@ -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),
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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,5 +1,5 @@
|
||||
pub mod access;
|
||||
pub mod ecfs;
|
||||
pub mod error;
|
||||
mod event_notifier;
|
||||
mod event;
|
||||
pub mod options;
|
||||
|
||||
Reference in New Issue
Block a user