fix: 解决indexedDB的getDB在失败重试时永远返回错误Promise问题

master^2
layhuts 2026-05-09 12:02:41 +08:00
parent df5cb426d1
commit b40822e3ed
1 changed files with 5 additions and 1 deletions

View File

@ -107,7 +107,11 @@ class IndexedDBDriver implements IStorageDriver {
*/ */
private getDB(): Promise<IDBDatabase> { private getDB(): Promise<IDBDatabase> {
if (!this.dbPromise) { if (!this.dbPromise) {
this.dbPromise = this.openDB(); this.dbPromise = this.openDB().catch((error) => {
// allow retry on next call
this.dbPromise = null;
throw error;
});
} }
return this.dbPromise; return this.dbPromise;
} }