Fix transaction cleanup

This commit is contained in:
jaina heartles 2022-12-10 01:41:26 -08:00
parent c6af6caec7
commit eae70d9b9c
1 changed files with 2 additions and 1 deletions

View File

@ -420,7 +420,7 @@ fn Tx(comptime tx_level: u8) type {
if (tx_level != 0) @compileError("close must be called on root db");
if (self.conn.current_tx_level != 0) {
std.log.warn("Database released while transaction in progress!", .{});
self.rollbackUnchecked() catch {};
self.rollbackUnchecked() catch {}; // TODO: Burn database connection
}
if (!self.conn.in_use.swap(false, .AcqRel)) @panic("Double close on db conection");
@ -719,6 +719,7 @@ fn Tx(comptime tx_level: u8) type {
fn rollbackUnchecked(self: Self) !void {
try self.execInternal("ROLLBACK", {}, .{}, false);
self.conn.current_tx_level = 0;
}
};
}