forked from lavina/lavina
rename telemetry mod to http
This commit is contained in:
parent
dc0a101fe6
commit
2f034284cf
|
@ -31,7 +31,7 @@ pub async fn launch(
|
|||
rooms: RoomRegistry,
|
||||
storage: Storage,
|
||||
) -> Result<Terminator> {
|
||||
log::info!("Starting the telemetry service");
|
||||
log::info!("Starting the http service");
|
||||
let listener = TcpListener::bind(config.listen_on).await?;
|
||||
log::debug!("Listener started");
|
||||
let terminator = Terminator::spawn(|rx| main_loop(listener, metrics, rooms, storage, rx.map(|_| ())));
|
||||
|
@ -67,7 +67,7 @@ async fn main_loop(
|
|||
},
|
||||
}
|
||||
}
|
||||
log::info!("Terminating the telemetry service");
|
||||
log::info!("Terminating the http service");
|
||||
Ok(())
|
||||
}
|
||||
|
16
src/main.rs
16
src/main.rs
|
@ -1,4 +1,4 @@
|
|||
mod util;
|
||||
mod http;
|
||||
|
||||
use std::future::Future;
|
||||
use std::path::Path;
|
||||
|
@ -16,7 +16,7 @@ use lavina_core::room::RoomRegistry;
|
|||
|
||||
#[derive(Deserialize, Debug)]
|
||||
struct ServerConfig {
|
||||
telemetry: util::telemetry::ServerConfig,
|
||||
telemetry: http::ServerConfig,
|
||||
irc: projection_irc::ServerConfig,
|
||||
xmpp: projection_xmpp::ServerConfig,
|
||||
storage: lavina_core::repo::StorageConfig,
|
||||
|
@ -53,9 +53,15 @@ async fn main() -> Result<()> {
|
|||
let storage = Storage::open(storage_config).await?;
|
||||
let rooms = RoomRegistry::new(&mut metrics, storage.clone())?;
|
||||
let mut players = PlayerRegistry::empty(rooms.clone(), &mut metrics)?;
|
||||
let telemetry_terminator =
|
||||
util::telemetry::launch(telemetry_config, metrics.clone(), rooms.clone(), storage.clone()).await?;
|
||||
let irc = projection_irc::launch(irc_config, players.clone(), rooms.clone(), metrics.clone(), storage.clone()).await?;
|
||||
let telemetry_terminator = http::launch(telemetry_config, metrics.clone(), rooms.clone(), storage.clone()).await?;
|
||||
let irc = projection_irc::launch(
|
||||
irc_config,
|
||||
players.clone(),
|
||||
rooms.clone(),
|
||||
metrics.clone(),
|
||||
storage.clone(),
|
||||
)
|
||||
.await?;
|
||||
let xmpp = projection_xmpp::launch(xmpp_config, players.clone(), rooms.clone(), metrics.clone()).await?;
|
||||
tracing::info!("Started");
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
pub mod telemetry;
|
||||
#[cfg(test)]
|
||||
pub mod testkit;
|
|
@ -1,16 +0,0 @@
|
|||
use std::task::{Context, Poll};
|
||||
|
||||
use futures_util::task::noop_waker_ref;
|
||||
|
||||
use lavina_core::prelude::*;
|
||||
|
||||
pub fn sync_future<T>(future: impl Future<Output = T>) -> Result<T> {
|
||||
let waker = noop_waker_ref();
|
||||
let mut context = Context::from_waker(waker);
|
||||
pin!(future);
|
||||
if let Poll::Ready(a) = future.poll(&mut context) {
|
||||
Ok(a)
|
||||
} else {
|
||||
Err(anyhow::Error::msg("Future has suspended"))
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue