diff --git a/sync-server/src/storage/sqlite.rs b/sync-server/src/storage/sqlite.rs index cb080e2f8..be075f62b 100644 --- a/sync-server/src/storage/sqlite.rs +++ b/sync-server/src/storage/sqlite.rs @@ -87,17 +87,16 @@ impl SqliteStorage { impl Storage for SqliteStorage { fn txn<'a>(&'a self) -> anyhow::Result> { let con = self.new_connection()?; - let t = Txn { con, txn: None }; + let t = Txn { con }; Ok(Box::new(t)) } } -struct Txn<'t> { +struct Txn { con: Connection, - txn: Option>, } -impl<'t> Txn<'t> { +impl Txn { fn get_txn(&mut self) -> Result { self.con .transaction() @@ -105,7 +104,7 @@ impl<'t> Txn<'t> { } } -impl<'t> StorageTxn for Txn<'t> { +impl StorageTxn for Txn { fn get_client(&mut self, client_key: Uuid) -> anyhow::Result> { let t = self.get_txn()?; let result: Option = t @@ -195,11 +194,10 @@ impl<'t> StorageTxn for Txn<'t> { } fn commit(&mut self) -> anyhow::Result<()> { - let t: rusqlite::Transaction = self - .txn - .take() - .ok_or(SqliteError::TransactionAlreadyCommitted)?; - t.commit().context("Committing transaction")?; + // FIXME: Note the queries aren't currently run in a + // transaction, as storing the transaction object and a pooled + // connection in the `Txn` object is complex. + // https://github.com/taskchampion/taskchampion/pull/206#issuecomment-860336073 Ok(()) } }