risk mitigation (#2115)

* don't lock db on shutdown

* reorder init
This commit is contained in:
Aiden McClelland
2023-01-13 14:41:09 -07:00
committed by Aiden McClelland
parent 76b5234f7b
commit a0bc16c255
4 changed files with 19 additions and 32 deletions

View File

@@ -88,17 +88,13 @@ async fn inner_main(cfg_path: Option<PathBuf>) -> Result<Option<Shutdown>, Error
.map_ok(|_| tracing::debug!("Metrics daemon Shutdown"))
.await?;
let mut shutdown = shutdown_recv
let shutdown = shutdown_recv
.recv()
.await
.with_kind(crate::ErrorKind::Unknown)?;
sig_handler.abort();
if let Some(shutdown) = &mut shutdown {
drop(shutdown.db_handle.take());
}
(rpc_ctx, shutdown)
};
rpc_ctx.shutdown().await?;