Start ephemera only on monitoring

This commit is contained in:
Bogdan-Ștefan Neacșu
2023-07-14 12:54:33 +03:00
parent 543eb8e8f5
commit 57e72d52c8
+21 -20
View File
@@ -121,29 +121,30 @@ async fn start_nym_api_tasks(
.await?;
}
let ephemera_config = match EphemeraConfiguration::try_load(config.get_ephemera_config_path()) {
Ok(c) => c,
Err(_) => {
config
.get_ephemera_args()
.cmd
.clone()
.execute(Some(&config.get_id()));
EphemeraConfiguration::try_load(config.get_ephemera_config_path())
.expect("Config file should be created now")
}
};
let ephemera_reward_manager = ephemera::application::NymApi::run(
config.get_ephemera_args().clone(),
ephemera_config,
nyxd_client.clone(),
&shutdown,
)
.await?;
// and then only start the uptime updater (and the monitor itself, duh)
// if the monitoring if it's enabled
if config.network_monitor.enabled {
let ephemera_config =
match EphemeraConfiguration::try_load(config.get_ephemera_config_path()) {
Ok(c) => c,
Err(_) => {
config
.get_ephemera_args()
.cmd
.clone()
.execute(Some(&config.get_id()));
EphemeraConfiguration::try_load(config.get_ephemera_config_path())
.expect("Config file should be created now")
}
};
let ephemera_reward_manager = ephemera::application::NymApi::run(
config.get_ephemera_args().clone(),
ephemera_config,
nyxd_client.clone(),
&shutdown,
)
.await?;
// if network monitor is enabled, the storage MUST BE available
let storage = maybe_storage.unwrap();