pipeline: remove broadcast function

This commit is contained in:
Alex Gleason 2024-04-02 19:53:11 -05:00
parent d577c51c74
commit 5e834d2a6b
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 1 additions and 18 deletions

View File

@ -9,7 +9,7 @@ import { isEphemeralKind } from '@/kinds.ts';
import { DVM } from '@/pipeline/DVM.ts';
import { updateStats } from '@/stats.ts';
import { hydrateEvents, purifyEvent } from '@/storages/hydrate.ts';
import { cache, client, eventsDB, reqmeister } from '@/storages.ts';
import { cache, eventsDB, reqmeister } from '@/storages.ts';
import { Sub } from '@/subs.ts';
import { getTagSet } from '@/tags.ts';
import { eventAge, isRelay, nostrDate, nostrNow, parseNip05, Time } from '@/utils.ts';
@ -43,7 +43,6 @@ async function handleEvent(event: DittoEvent, signal: AbortSignal): Promise<void
processMedia(event),
payZap(event, signal),
streamOut(event),
broadcast(event, signal),
]);
}
@ -257,22 +256,6 @@ function streamOut(event: NostrEvent) {
}
}
/**
* Publish the event to other relays.
* This should only be done in certain circumstances, like mentioning a user or publishing deletions.
*/
async function broadcast(event: DittoEvent, signal: AbortSignal) {
if (!event.user || !isFresh(event)) return;
if (event.kind === 5) {
try {
await client.event(event, { signal });
} catch (e) {
debug(e);
}
}
}
/** NIP-20 command line result. */
class RelayError extends Error {
constructor(prefix: 'duplicate' | 'pow' | 'blocked' | 'rate-limited' | 'invalid' | 'error', message: string) {