Iris nip-05 registration #638

Merged
Kieran merged 7 commits from mmalmi/snort:main into main 2023-10-04 10:44:26 +00:00
Showing only changes of commit e191528c4c - Show all commits

View File

@ -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)));