Skip to content

Commit 102d013

Browse files
committed
fix: remove redundant if statement
1 parent a68efca commit 102d013

2 files changed

Lines changed: 2 additions & 23 deletions

File tree

query-engine/core/src/interactive_transactions/manager.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,8 @@ impl ItxManager {
116116
if self.transactions.read().await.contains_key(&tx_id) {
117117
let transaction_entry = self.get_transaction(&tx_id, "begin").await?;
118118
let mut tx = transaction_entry.lock().await;
119-
// If the transaction is already open, we need to create a savepoint.
120-
if tx.depth() > 0 {
121-
tx.create_savepoint().await?;
122-
} else {
123-
tx.begin().await?;
124-
}
119+
// The transaction is already open, so we need to create a savepoint.
120+
tx.create_savepoint().await?;
125121
} else {
126122
// This task notifies the task spawned in `new()` method that the timeout for this
127123
// transaction has expired.

query-engine/core/src/interactive_transactions/transaction.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -204,23 +204,6 @@ impl InteractiveTransaction {
204204
}
205205
}
206206

207-
pub async fn begin(&mut self) -> crate::Result<()> {
208-
tx_timeout!(self, "begin", async {
209-
let name = self.name();
210-
let conn = self.state.as_open("begin")?;
211-
let span = info_span!("prisma:engine:itx_begin", user_facing = true);
212-
213-
if let Err(err) = conn.begin().instrument(span).await {
214-
error!(?err, ?name, "transaction failed to begin");
215-
let _ = self.rollback(false).await;
216-
Err(err.into())
217-
} else {
218-
debug!(?name, "transaction started");
219-
Ok(())
220-
}
221-
})
222-
}
223-
224207
pub async fn commit(&mut self) -> crate::Result<()> {
225208
tx_timeout!(self, "commit", async {
226209
let name = self.name();

0 commit comments

Comments
 (0)