Skip to content

Commit

Permalink
fix: remove redundant if statement
Browse files Browse the repository at this point in the history
  • Loading branch information
LucianBuzzo committed Jan 23, 2025
1 parent 3b902b6 commit 41a39b5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
8 changes: 2 additions & 6 deletions query-engine/core/src/interactive_transactions/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,8 @@ impl ItxManager {
if self.transactions.read().await.contains_key(&tx_id) {
let transaction_entry = self.get_transaction(&tx_id, "begin").await?;
let mut tx = transaction_entry.lock().await;
// If the transaction is already open, we need to create a savepoint.
if tx.depth() > 0 {
tx.create_savepoint().await?;
} else {
tx.begin().await?;
}
// The transaction is already open, so we need to create a savepoint.
tx.create_savepoint().await?;
} else {
// This task notifies the task spawned in `new()` method that the timeout for this
// transaction has expired.
Expand Down
17 changes: 0 additions & 17 deletions query-engine/core/src/interactive_transactions/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,23 +204,6 @@ impl InteractiveTransaction {
}
}

pub async fn begin(&mut self) -> crate::Result<()> {
tx_timeout!(self, "begin", async {
let name = self.name();
let conn = self.state.as_open("begin")?;
let span = info_span!("prisma:engine:itx_begin", user_facing = true);

if let Err(err) = conn.begin().instrument(span).await {
error!(?err, ?name, "transaction failed to begin");
let _ = self.rollback(false).await;
Err(err.into())
} else {
debug!(?name, "transaction started");
Ok(())
}
})
}

pub async fn commit(&mut self) -> crate::Result<()> {
tx_timeout!(self, "commit", async {
let name = self.name();
Expand Down

0 comments on commit 41a39b5

Please sign in to comment.