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);
|
const k = this.key(obj);
|
||||||
this.cache.set(k, obj);
|
this.cache.set(k, obj);
|
||||||
if (this.table) {
|
if (this.table) {
|
||||||
|
try {
|
||||||
await this.table.put(obj);
|
await this.table.put(obj);
|
||||||
this.onTable.add(k);
|
this.onTable.add(k);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.notifyChange([k]);
|
this.notifyChange([k]);
|
||||||
}
|
}
|
||||||
|
|
||||||
async bulkSet(obj: Array<TCached> | Readonly<Array<TCached>>) {
|
async bulkSet(obj: Array<TCached> | Readonly<Array<TCached>>) {
|
||||||
if (this.table) {
|
if (this.table) {
|
||||||
|
try {
|
||||||
await this.table.bulkPut(obj);
|
await this.table.bulkPut(obj);
|
||||||
obj.forEach(a => this.onTable.add(this.key(a)));
|
obj.forEach(a => this.onTable.add(this.key(a)));
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
obj.forEach(v => this.cache.set(this.key(v), v));
|
obj.forEach(v => this.cache.set(this.key(v), v));
|
||||||
this.notifyChange(obj.map(a => this.key(a)));
|
this.notifyChange(obj.map(a => this.key(a)));
|
||||||
|
Loading…
Reference in New Issue
Block a user