use seenEvents in IndexedDB

This commit is contained in:
Martti Malmi
2024-01-04 10:37:39 +02:00
parent 287ce32690
commit d31a03a565
4 changed files with 7 additions and 8 deletions

View File

@ -9,7 +9,7 @@ import { ConnectionStats } from "./connection-stats";
import { NostrEvent, ReqCommand, ReqFilter, TaggedNostrEvent, u256 } from "./nostr";
import { RelayInfo } from "./relay-info";
import EventKind from "./event-kind";
import seenEvents from "./seen-events";
import { seenEvents } from "./seen-events";
import {getHex64} from "./utils";
/**
@ -204,7 +204,6 @@ export class Connection extends EventEmitter<ConnectionEvents> {
// skip message processing if we've already seen it
const msgId = getHex64(e.data as string, "id");
if (seenEvents.has(msgId)) {
console.log('already seen');
return;
}
seenEvents.add(msgId); // TODO only do after msg validation

View File

@ -33,6 +33,7 @@ export * from "./query-optimizer";
export * from "./encrypted";
export * from "./outbox-model";
export { parseIMeta } from "./utils";
export * from "./seen-events";
export * from "./impl/nip4";
export * from "./impl/nip44";

View File

@ -1,3 +1,3 @@
import LRUSet from "@snort/shared/src/LRUSet";
export default new LRUSet<string>(2000);
export const seenEvents = new LRUSet<string>(2000);