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>
bzip2
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 connection.autoCommit = false
try { try {
try { val result = try {
val result = transaction.execute(connection) transaction.execute(connection)
connection.commit() } catch (t: Throwable) {
return result
} finally {
connection.rollback() connection.rollback()
throw t
} }
connection.commit()
return result
} finally { } finally {
connection.autoCommit = oldAutoCommit connection.autoCommit = oldAutoCommit
} }

Loading…
Cancel
Save