mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-27 20:41:58 +03:00
Reformulate the forceReinitIfFailed handling based on feedback, to correct the type-checking and resolve a potential race condition.
FossilOrigin-Name: c4f468309158f9b951137461213fb269d96d15c331256cf392a56c9bed231460
This commit is contained in:
@ -1225,13 +1225,19 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
||||
throw options.$testThrowPhase1;
|
||||
}
|
||||
if(initPromises[vfsName]){
|
||||
const p = initPromises[vfsName];
|
||||
if( (p instanceof OpfsSAHPool) || !options.forceReinitIfFailed ){
|
||||
//log("Returning cached installOpfsSAHPoolVfs() result",options,vfsName,initPromises[vfsName]);
|
||||
try {
|
||||
const p = await initPromises[vfsName];
|
||||
//log("installOpfsSAHPoolVfs() returning cached result",options,vfsName,p);
|
||||
return p;
|
||||
}catch(e){
|
||||
//log("installOpfsSAHPoolVfs() got cached failure",options,vfsName,e);
|
||||
if( options.forceReinitIfFailed ){
|
||||
delete initPromises[vfsName];
|
||||
/* Fall through and try again. */
|
||||
}else{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
delete initPromises[vfsName];
|
||||
/* Fall through and try again. */
|
||||
}
|
||||
if(!globalThis.FileSystemHandle ||
|
||||
!globalThis.FileSystemDirectoryHandle ||
|
||||
|
Reference in New Issue
Block a user