aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/api
diff options
context:
space:
mode:
Diffstat (limited to 'ext/wasm/api')
-rw-r--r--ext/wasm/api/sqlite3-opfs-async-proxy.js29
-rw-r--r--ext/wasm/api/sqlite3-vfs-opfs.c-pp.js10
2 files changed, 21 insertions, 18 deletions
diff --git a/ext/wasm/api/sqlite3-opfs-async-proxy.js b/ext/wasm/api/sqlite3-opfs-async-proxy.js
index d8234d509..e77ff7809 100644
--- a/ext/wasm/api/sqlite3-opfs-async-proxy.js
+++ b/ext/wasm/api/sqlite3-opfs-async-proxy.js
@@ -263,21 +263,18 @@ const installAsyncProxy = function(self){
}
};
GetSyncHandleError.convertRc = (e,rc)=>{
- if(0){
- /* This approach makes the very wild assumption that such a
- failure _is_ a locking error. In practice that appears to be
- the most common error, by far, but we cannot unambiguously
- distinguish that from other errors.
-
- This approach is highly questionable.
-
- Note that even if we return SQLITE_IOERR_LOCK from here,
- it bubbles up to the client as a plain I/O error.
- */
- return (e instanceof GetSyncHandleError
- && e.cause.name==='NoModificationAllowedError')
- ? state.sq3Codes.SQLITE_IOERR_LOCK
- : rc;
+ if(1){
+ return (
+ e instanceof GetSyncHandleError
+ && ((e.cause.name==='NoModificationAllowedError')
+ /* Inconsistent exception.name from Chrome/ium with the
+ same exception.message text: */
+ || (e.cause.name==='DOMException'
+ && 0===e.cause.message.indexOf('Access Handles cannot')))
+ ) ? (
+ /*console.warn("SQLITE_BUSY",e),*/
+ state.sq3Codes.SQLITE_BUSY
+ ) : rc;
}else{
return rc;
}
@@ -298,7 +295,7 @@ const installAsyncProxy = function(self){
if(!fh.syncHandle){
const t = performance.now();
log("Acquiring sync handle for",fh.filenameAbs);
- const maxTries = 6, msBase = state.asyncIdleWaitTime * 3;
+ const maxTries = 5, msBase = state.asyncIdleWaitTime * 2;
let i = 1, ms = msBase;
for(; true; ms = msBase * ++i){
try {
diff --git a/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js b/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js
index 7b0a0b322..85e65a4ae 100644
--- a/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js
+++ b/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js
@@ -277,7 +277,7 @@ const installOpfsVfs = function callee(options){
of this value is also used for determining how long to wait on
lock contention to free up.
*/
- state.asyncIdleWaitTime = 100;
+ state.asyncIdleWaitTime = 150;
/**
Whether the async counterpart should log exceptions to
the serialization channel. That produces a great deal of
@@ -636,6 +636,12 @@ const installOpfsVfs = function callee(options){
a[i] = f._chars[ndx];
}
return a.join("");
+ /*
+ An alternative impl. with an unpredictable length
+ but much simpler:
+
+ Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(36)
+ */
};
/**
@@ -1159,7 +1165,7 @@ const installOpfsVfs = function callee(options){
"pragma journal_mode=persist;",
/* Set a default busy-timeout handler to help OPFS dbs
deal with multi-tab/multi-worker contention. */
- "pragma busy_timeout=3000;",
+ "pragma busy_timeout=5000;",
/*
This vfs benefits hugely from cache on moderate/large
speedtest1 --size 50 and --size 100 workloads. We currently