Skip to content

Commit 7516136

Browse files
cleanup. call releaseAccessHandle on error
1 parent 355cd27 commit 7516136

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/examples/OPFSCoopSyncVFS.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -532,15 +532,7 @@ export class OPFSCoopSyncVFS extends FacadeVFS {
532532
} catch (e) {
533533
this.log?.(`failed to create access handles for ${file.path}`, e);
534534
// Close any of the potentially opened access handles
535-
DB_RELATED_FILE_SUFFIXES.forEach(async suffix => {
536-
const persistentFile = this.persistentFiles.get(file.path + suffix);
537-
if (persistentFile) {
538-
persistentFile.accessHandle?.close();
539-
}
540-
});
541-
// Release the lock, if we failed here, we'd need to obtain the lock later in order to retry
542-
file.persistentFile.handleLockReleaser();
543-
file.persistentFile.handleLockReleaser = null;
535+
this.#releaseAccessHandle(file);
544536
throw e;
545537
} finally {
546538
file.persistentFile.isRequestInProgress = false;

0 commit comments

Comments
 (0)