rm redundant Events.seen

This commit is contained in:
Martti Malmi 2023-08-19 15:12:21 +03:00
parent 4f835d5080
commit 2534462b4d
3 changed files with 7 additions and 10 deletions

View File

@ -34,7 +34,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: app-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version
releaseName: 'App v__VERSION__'
releaseName: 'Iris v__VERSION__'
releaseBody: 'See the assets to download this version and install.'
releaseDraft: true
prerelease: false

View File

@ -19,7 +19,7 @@ import {
getRepostedEventId,
isRepost,
} from '@/nostr/utils.ts';
import { ID, STR, UID, UniqueIds } from '@/utils/UniqueIds.ts';
import { ID, STR, UniqueIds } from '@/utils/UniqueIds.ts';
import localState from '../LocalState';
import { Node } from '../LocalState';
@ -65,7 +65,6 @@ const Events = {
DEFAULT_GLOBAL_FILTER,
getEventHash,
eventsMetaDb: new EventMetaStore(),
seen: new Set<UID>(),
deletedEvents: new Set<string>(),
latestNotificationByTargetAndKind: new Map<string, string>(),
notifications: new SortedLimitedEventSet(MAX_LATEST_MSGS),
@ -440,11 +439,11 @@ const Events = {
return true;
},
handle(event: Event & { id: string }, force = false, saveToIdb = true, retries = 2): boolean {
if (!event) return false;
const id = ID(event.id);
if (!force && this.seen.has(id)) {
if (!event?.id) return false;
if (!force && UniqueIds.has(event.id)) {
return false;
}
ID(event.id); // add to UniqueIds
if (!force && !this.acceptEvent(event)) {
if (retries) {
// should we retry only if iris has been opened within the last few seconds or the social graph changed?
@ -481,8 +480,6 @@ const Events = {
return false;
}
this.seen.add(id);
this.handledMsgsPerSecond++;
PubSub.subscribedEventIds.delete(event.id);

View File

@ -6,7 +6,7 @@ import Filter from '@/nostr/Filter';
const { authenticate } = nip42;
import EventDB from '@/nostr/EventDB.ts';
import { ID } from '@/utils/UniqueIds.ts';
import { UniqueIds } from '@/utils/UniqueIds.ts';
import localState from '../LocalState';
import Events from '../nostr/Events';
@ -26,7 +26,7 @@ const relayPool = new RelayPool(Relays.enabledRelays(), {
autoReconnect: true,
externalGetEventById: (id) => {
return (
(Events.seen.has(ID(id)) && {
(UniqueIds.has(id) && {
sig: '',
id: '',
kind: 0,