Fix transaction cleanup
This commit is contained in:
parent
c6af6caec7
commit
eae70d9b9c
1 changed files with 2 additions and 1 deletions
|
@ -420,7 +420,7 @@ fn Tx(comptime tx_level: u8) type {
|
||||||
if (tx_level != 0) @compileError("close must be called on root db");
|
if (tx_level != 0) @compileError("close must be called on root db");
|
||||||
if (self.conn.current_tx_level != 0) {
|
if (self.conn.current_tx_level != 0) {
|
||||||
std.log.warn("Database released while transaction in progress!", .{});
|
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");
|
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 {
|
fn rollbackUnchecked(self: Self) !void {
|
||||||
try self.execInternal("ROLLBACK", {}, .{}, false);
|
try self.execInternal("ROLLBACK", {}, .{}, false);
|
||||||
|
self.conn.current_tx_level = 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue