catch idb write error in set and bulkSet
Some checks failed
continuous-integration/drone/pr Build is failing
Some checks failed
continuous-integration/drone/pr Build is failing
This commit is contained in:
parent
317b58b298
commit
e191528c4c
@ -109,16 +109,24 @@ export abstract class FeedCache<TCached> {
|
||||
const k = this.key(obj);
|
||||
this.cache.set(k, obj);
|
||||
if (this.table) {
|
||||
try {
|
||||
await this.table.put(obj);
|
||||
this.onTable.add(k);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
this.notifyChange([k]);
|
||||
}
|
||||
|
||||
async bulkSet(obj: Array<TCached> | Readonly<Array<TCached>>) {
|
||||
if (this.table) {
|
||||
try {
|
||||
await this.table.bulkPut(obj);
|
||||
obj.forEach(a => this.onTable.add(this.key(a)));
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
obj.forEach(v => this.cache.set(this.key(v), v));
|
||||
this.notifyChange(obj.map(a => this.key(a)));
|
||||
|
Loading…
Reference in New Issue
Block a user