Skip to content

Commit 495631d

Browse files
author
cubic Bot
committed
Always finalize prepared statements by adding try/finally (merges into #1990)
1 parent 960b0c7 commit 495631d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

packages/memory/space.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -782,10 +782,14 @@ const commit = <Space extends MemorySpace>(
782782
const the = COMMIT_LOG_TYPE;
783783
const of = transaction.sub;
784784
const stmt = session.store.prepare(EXPORT);
785-
const row = stmt.get({ the, of }) as
786-
| StateRow
787-
| undefined;
788-
stmt.finalize();
785+
let row: StateRow | undefined;
786+
try {
787+
row = stmt.get({ the, of }) as
788+
| StateRow
789+
| undefined;
790+
} finally {
791+
stmt.finalize();
792+
}
789793

790794
const [since, cause] = row
791795
? [

0 commit comments

Comments
 (0)