forked from lavina/lavina
1
0
Fork 0

Fix Storage closing during app shutdown.

Storage was still co-owned by the RoomRegistry, which did not allow us to shut it down gracefully. Dropping RoomRegistry explicitly helps.
This commit is contained in:
Nikita Vilunov 2023-08-17 18:35:50 +02:00
parent 1b5ac1491a
commit f401aa786e
1 changed files with 4 additions and 2 deletions

View File

@ -58,7 +58,7 @@ async fn main() -> Result<()> {
let telemetry_terminator =
util::telemetry::launch(telemetry_config, metrics.clone(), rooms.clone()).await?;
let irc = projections::irc::launch(irc_config, players.clone(), rooms.clone(), metrics.clone(), storage.clone()).await?;
let xmpp = projections::xmpp::launch(xmpp_config, players, rooms.clone(), metrics.clone()).await?;
let xmpp = projections::xmpp::launch(xmpp_config, players.clone(), rooms.clone(), metrics.clone()).await?;
tracing::info!("Started");
sleep.await;
@ -66,8 +66,10 @@ async fn main() -> Result<()> {
tracing::info!("Begin shutdown");
xmpp.terminate().await?;
irc.terminate().await?;
storage.close().await?;
telemetry_terminator.terminate().await?;
drop(players);
drop(rooms);
storage.close().await?;
tracing::info!("Shutdown complete");
Ok(())
}