aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-02-19 19:59:24 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-02-19 19:59:24 -0500
commita8b1e40a1e34178d9907b04f3a8e16a21b9eb42a (patch)
tree199ba6443e5589312d6ea5adce097a46ef3169b1
parent7901a467217f311566e7a3bc83ceafa17909d511 (diff)
Close to prevent hangs
-rw-r--r--ext/bg/js/database.js6
-rw-r--r--test/test-database.js2
2 files changed, 8 insertions, 0 deletions
diff --git a/ext/bg/js/database.js b/ext/bg/js/database.js
index b54d832c..02d59c83 100644
--- a/ext/bg/js/database.js
+++ b/ext/bg/js/database.js
@@ -96,6 +96,12 @@ class Database {
}
}
+ async close() {
+ this.validate();
+ this.db.close();
+ this.db = null;
+ }
+
async purge() {
this.validate();
diff --git a/test/test-database.js b/test/test-database.js
index d66e2137..cefa297c 100644
--- a/test/test-database.js
+++ b/test/test-database.js
@@ -130,6 +130,8 @@ async function testDatabase1() {
// Cleanup
await cleanup();
}
+
+ await database.close();
}
async function testDatabaseEmpty1(database) {