Add admin debug command to manually resync with primary. (#35)

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk
2025-07-23 04:09:25 +00:00
parent 535fcab4b5
commit 17119670c0
2 changed files with 16 additions and 0 deletions

View File

@@ -1035,3 +1035,16 @@ pub(super) async fn create_jwt(
.map(async |token| self.write_str(&token).await)?
.await
}
#[admin_command]
pub(super) async fn resync_database(&self) -> Result {
if !self.services.db.is_secondary() {
return Err!("Not a secondary instance.");
}
self.services
.db
.db
.update()
.map_err(|e| err!("Failed to update from primary: {e:?}"))
}

View File

@@ -256,6 +256,9 @@ pub(super) enum DebugCommand {
audience: Option<String>,
},
/// - Synchronize database with primary (secondary only)
ResyncDatabase,
/// - Developer test stubs
#[command(subcommand)]
#[allow(non_snake_case)]