From 0cdd3f69caee90f4bf308f76ecda33a61498b806 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Wed, 17 May 2023 19:12:31 +0200 Subject: [PATCH] secret: Fix v3 migration If the migration is not needed, the migration would go in a loop. --- src/secret.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/secret.rs b/src/secret.rs index 9d94fc1c..6d966549 100644 --- a/src/secret.rs +++ b/src/secret.rs @@ -482,11 +482,7 @@ impl StoredSession { let target_path = DATA_PATH.join(self.id()); - if self.path == target_path { - return; - } - - spawn_tokio!(async move { + if self.path != target_path { debug!("Moving database to: {}", target_path.to_string_lossy()); if let Err(error) = fs::create_dir_all(&target_path) { @@ -498,8 +494,11 @@ impl StoredSession { } self.path = target_path; - self.version = 3; + } + + self.version = 3; + spawn_tokio!(async move { if let Err(error) = item.delete().await { error!("Failed to remove outdated session: {error}"); }