fix: 🐛 Add a better db check (#2993)
This commit is contained in:
1 parent
74793a2399
commit
bce79f3488
1 file changed
+4
@@ -20,6 +20,8 @@ let poolUtil;
|
||||
/** @type {import('@sqlite.org/sqlite-wasm').Sqlite3Static} */
|
||||
let sqlite3;
|
||||
|
||||
const { promise: ready, resolve: readyResolve } = Promise.withResolvers();
|
||||
|
||||
// Maximum number of host parameters for SQLite prepared statements.
|
||||
// See "Maximum Number Of Host Parameters In A Single SQL Statement" in
|
||||
// https://www.sqlite.org/limits.html
|
||||
@@ -194,6 +196,7 @@ const methods = {
|
||||
const promiseWorker = new PWBWorker();
|
||||
promiseWorker.register(async ({ method, payload }) => {
|
||||
if (!sharedService) {
|
||||
await ready;
|
||||
return methods[method](payload);
|
||||
}
|
||||
|
||||
@@ -221,5 +224,6 @@ if (isSecure) {
|
||||
// Production builds error out when using top level awaits so we'll just use an async IIFE
|
||||
(async () => {
|
||||
await methods.initializeSQLite();
|
||||
readyResolve();
|
||||
})();
|
||||
}
|
||||
Reference in new issue
Block a user