Add admin debug command to manually resync with primary. (#35)
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -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:?}"))
|
||||
}
|
||||
|
||||
@@ -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)]
|
||||
|
||||
Reference in New Issue
Block a user