From 7e4d38909ca25ea9e451ced0f86d037d8cba9432 Mon Sep 17 00:00:00 2001 From: ad hoc Date: Thu, 12 Oct 2023 10:50:18 +0200 Subject: [PATCH] fmt --- sqld/src/replication/replica/injector/mod.rs | 8 +++++--- sqld/src/replication/replica/replicator.rs | 5 ++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/sqld/src/replication/replica/injector/mod.rs b/sqld/src/replication/replica/injector/mod.rs index 32585c90..5918a152 100644 --- a/sqld/src/replication/replica/injector/mod.rs +++ b/sqld/src/replication/replica/injector/mod.rs @@ -119,7 +119,8 @@ impl Injector { let connection = self.connection.lock(); // use prepare cached to avoid parsing the same statement over and over again. - let mut stmt = connection.prepare_cached("INSERT INTO libsql_temp_injection VALUES (42)")?; + let mut stmt = + connection.prepare_cached("INSERT INTO libsql_temp_injection VALUES (42)")?; stmt.execute(())?; // force call to xframe match connection.cache_flush() { @@ -129,8 +130,9 @@ impl Injector { if e.extended_code == LIBSQL_INJECT_OK { // refresh schema connection.pragma_update(None, "writable_schema", "reset")?; - if let Err(e) = connection.execute("COMMIT", ()) { - if !matches!(e.sqlite_error(), Some(rusqlite::ffi::Error{ extended_code, .. }) if *extended_code == 201) { + if let Err(e) = connection.execute("COMMIT", ()) { + if !matches!(e.sqlite_error(), Some(rusqlite::ffi::Error{ extended_code, .. }) if *extended_code == 201) + { tracing::error!("injector failed to commit: {e}"); return Err(Error::FatalReplicationError); } diff --git a/sqld/src/replication/replica/replicator.rs b/sqld/src/replication/replica/replicator.rs index 507b1b13..f562b0b5 100644 --- a/sqld/src/replication/replica/replicator.rs +++ b/sqld/src/replication/replica/replicator.rs @@ -212,7 +212,10 @@ impl Replicator { Ok(None) => (), Err(e @ crate::Error::FatalReplicationError) => { // we conservatively nuke the replica and start replicating from scractch - tracing::error!("fatal error replicating `{}` from primary, reseting namespace...", self.namespace); + tracing::error!( + "fatal error replicating `{}` from primary, reseting namespace...", + self.namespace + ); (self.reset)(ResetOp::Destroy(self.namespace.clone())); Err(e)? }