fix: don't crash when closing before connecting to anything

This commit is contained in:
əlemi 2022-11-10 21:52:52 +01:00
parent 0ce377ed6d
commit 35f1675a00
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -320,7 +320,10 @@ impl AppState {
pub async fn worker(mut self, run:watch::Receiver<bool>) {
let mut now;
let first_db_uri = self.db_uri.recv().await.unwrap();
let Some(first_db_uri) = self.db_uri.recv().await else {
warn!(target: "state-manager", "No initial database URI, skipping first connection");
return;
};
let mut db = Database::connect(first_db_uri.clone()).await.unwrap();