fix: drain account shutdown before reopening persistence
This commit is contained in:
1 parent
0f358b2ac2
commit
1001f55a06
7 files changed
+286
-109
No files matched your search
@@ -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 });
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user