aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/api/sqlite3-opfs-async-proxy.js
diff options
context:
space:
mode:
authorstephan <stephan@noemail.net>2022-11-21 05:18:24 +0000
committerstephan <stephan@noemail.net>2022-11-21 05:18:24 +0000
commitb38ac0986e86d56115396c36355d4e751cc4f7f5 (patch)
tree33d263ac06b881ac99bad30730d42a62543b7f94 /ext/wasm/api/sqlite3-opfs-async-proxy.js
parent36d5554c9abaa3080e85e3b7b517605c6106587d (diff)
downloadsqlite-b38ac0986e86d56115396c36355d4e751cc4f7f5.tar.gz
sqlite-b38ac0986e86d56115396c36355d4e751cc4f7f5.zip
More tweaking of OPFS concurrency measures and the related test app.
FossilOrigin-Name: a8d4da1501d411085ec2fd48c4a056c8b1d97ef3c3203c5b403a854ac2864870
Diffstat (limited to 'ext/wasm/api/sqlite3-opfs-async-proxy.js')
-rw-r--r--ext/wasm/api/sqlite3-opfs-async-proxy.js21
1 files changed, 9 insertions, 12 deletions
diff --git a/ext/wasm/api/sqlite3-opfs-async-proxy.js b/ext/wasm/api/sqlite3-opfs-async-proxy.js
index 58cf8ca3c..c208932e1 100644
--- a/ext/wasm/api/sqlite3-opfs-async-proxy.js
+++ b/ext/wasm/api/sqlite3-opfs-async-proxy.js
@@ -220,22 +220,19 @@ class GetSyncHandleError extends Error {
}
};
GetSyncHandleError.convertRc = (e,rc)=>{
- if(1){
- /* This approach returns SQLITE_LOCKED to the C API
- when getSyncHandle() fails but 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
+ 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 demonstrably reduces concurrency-related
- errors but is highly questionable.
+ This approach is highly questionable.
*/
return (e instanceof GetSyncHandleError)
- ? state.sq3Codes.SQLITE_LOCKED
+ ? state.sq3Codes.SQLITE_IOERR_LOCK
: rc;
}else{
- return ec;
+ return rc;
}
}
/**
@@ -253,7 +250,7 @@ const getSyncHandle = async (fh)=>{
if(!fh.syncHandle){
const t = performance.now();
log("Acquiring sync handle for",fh.filenameAbs);
- const maxTries = 4, msBase = 300;
+ const maxTries = 6, msBase = 300;
let i = 1, ms = msBase;
for(; true; ms = msBase * ++i){
try {
@@ -271,7 +268,7 @@ const getSyncHandle = async (fh)=>{
}
warn("Error getting sync handle. Waiting",ms,
"ms and trying again.",fh.filenameAbs,e);
- //await closeAutoLocks();
+ await closeAutoLocks();
Atomics.wait(state.sabOPView, state.opIds.retry, 0, ms);
}
}