pipeline: don't store ephemeral events

This commit is contained in:
Alex Gleason 2023-08-26 13:40:10 -05:00
parent 2aefdc4bd1
commit 1b2a486c65
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 2 additions and 0 deletions

View File

@ -2,6 +2,7 @@ import * as eventsDB from '@/db/events.ts';
import { addRelays } from '@/db/relays.ts';
import { findUser } from '@/db/users.ts';
import { type Event, LRUCache } from '@/deps.ts';
import { isEphemeralKind } from '@/kinds.ts';
import { isLocallyFollowed } from '@/queries.ts';
import { Sub } from '@/subs.ts';
import { trends } from '@/trends.ts';
@ -43,6 +44,7 @@ async function getEventData({ pubkey }: Event): Promise<EventData> {
/** Maybe store the event, if eligible. */
async function storeEvent(event: Event, data: EventData): Promise<void> {
if (isEphemeralKind(event.kind)) return;
if (data.user || await isLocallyFollowed(event.pubkey)) {
await eventsDB.insertEvent(event).catch(console.warn);
} else {