Skip to content

Commit 3f027b8

Browse files
authored
fix: Restarting while connection is still active (#35)
* Close connection * Fix stuff * Adding connection close mock function for test
1 parent f990b13 commit 3f027b8

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

meerkat-dbm/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devrev/meerkat-dbm",
3-
"version": "0.0.13",
3+
"version": "0.0.131",
44
"dependencies": {
55
"tslib": "^2.3.0",
66
"@duckdb/duckdb-wasm": "^1.28.0",

meerkat-dbm/src/dbm/dbm.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ const mockDB = {
8383
}, 200);
8484
});
8585
},
86+
close: async () => {
87+
// do nothing
88+
},
8689
};
8790
},
8891
};

meerkat-dbm/src/dbm/dbm.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ export class DBM {
5353
}
5454

5555
private async _shutdown() {
56+
if (this.connection) {
57+
await this.connection.close();
58+
this.connection = null;
59+
}
60+
this.logger.debug('Shutting down the DB');
5661
await this.instanceManager.terminateDB();
5762
}
5863

0 commit comments

Comments
 (0)