From d51c348a3fc2c23cf0283292f86b6bbe8142ddf3 Mon Sep 17 00:00:00 2001 From: asonix Date: Fri, 7 Jul 2023 14:05:13 -0500 Subject: [PATCH] Run health checks on old and new stores before migrating --- src/lib.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index ca93495..569bfc6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1483,7 +1483,18 @@ where S2: Store + Clone, R: IdentifierRepo + HashRepo + SettingsRepo + QueueRepo, { - tracing::warn!("Migrating store"); + tracing::warn!("Running checks"); + + if let Err(e) = from.health_check().await { + tracing::warn!("Old store is not configured correctly"); + return Err(e.into()); + } + if let Err(e) = to.health_check().await { + tracing::warn!("New store is not configured correctly"); + return Err(e.into()); + } + + tracing::warn!("Checks complete, migrating store"); let mut failure_count = 0;