This commit is contained in:
Kieran 2024-01-18 22:47:29 +00:00
parent aa9d5d72be
commit 0307bacd30
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
2 changed files with 8 additions and 8 deletions

View File

@ -81,9 +81,7 @@ export class ProfileCacheRelayWorker extends EventEmitter<CacheEvents> implement
this.emit("change", mapped); this.emit("change", mapped);
} }
async update<TWithCreated extends CachedMetadata & { created: number; loaded: number }>( async update(): Promise<"new" | "refresh" | "updated" | "no_change"> {
m: TWithCreated,
): Promise<"new" | "refresh" | "updated" | "no_change"> {
// do nothing // do nothing
return "refresh"; return "refresh";
} }

View File

@ -157,11 +157,13 @@ export class WorkerRelay extends EventEmitter<WorkerRelayEvents> {
}); });
let eventInserted = (this.#db?.changes() as number) > 0; let eventInserted = (this.#db?.changes() as number) > 0;
if (eventInserted) { if (eventInserted) {
for (const t of ev.tags.filter(a => a[0].length === 1)) { db.transaction(db => {
db.exec("insert into tags(event_id, key, value) values(?, ?, ?)", { for (const t of ev.tags.filter(a => a[0].length === 1)) {
bind: [ev.id, t[0], t[1]], db.exec("insert into tags(event_id, key, value) values(?, ?, ?)", {
}); bind: [ev.id, t[0], t[1]],
} });
}
});
} }
this.#seenInserts.add(ev.id); this.#seenInserts.add(ev.id);
return eventInserted; return eventInserted;