Remove redundant rollback after a successful commit

No functional change, but I suspect this might remove a database round
trip.

Signed-off-by: Graham <gpe@openrs2.dev>
Graham 4 years ago
parent 3ee8005ab7
commit f9c14aad14
  1. 13
      db/src/main/java/dev/openrs2/db/Database.kt

@ -85,13 +85,16 @@ public class Database(
connection.autoCommit = false
try {
try {
val result = transaction.execute(connection)
connection.commit()
return result
} finally {
val result = try {
transaction.execute(connection)
} catch (t: Throwable) {
connection.rollback()
throw t
}
connection.commit()
return result
} finally {
connection.autoCommit = oldAutoCommit
}

Loading…
Cancel
Save