fix: drain account shutdown before reopening persistence

This commit is contained in:
手瓜一十雪 committed 2026-10-18 13:52:13 +08:00
1 parent 0f358b2ac2
commit 1001f55a06
7 files changed
+286 -109

No files matched your search

+6 -1
View File
@@ -19,8 +19,13 @@ export class SqliteDatabase {
private pending = 0;
private shutdown: { task: Promise<void> | null } | null = null;
constructor(filename: string, options: { readOnly?: boolean; busyTimeout?: number } = {}) {
constructor(
filename: string,
options: { readOnly?: boolean; busyTimeout?: number; beforeOpen?: Promise<void> } = {},
) {
this.initialization = (async () => {
await options.beforeOpen;
if (!options.readOnly && filename !== ':memory:') {
await mkdir(path.dirname(filename), { recursive: true });
}