From 02049ed9d1f83253d030b4edb33001f506861994 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 5 Sep 2023 17:10:20 -0500 Subject: [PATCH] pipeline: fix isFresh comparison --- src/pipeline.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pipeline.ts b/src/pipeline.ts index 573dafb..c1974d6 100644 --- a/src/pipeline.ts +++ b/src/pipeline.ts @@ -7,7 +7,7 @@ import { isEphemeralKind } from '@/kinds.ts'; import { isLocallyFollowed } from '@/queries.ts'; import { Sub } from '@/subs.ts'; import { trends } from '@/trends.ts'; -import { isRelay, nostrDate, nostrNow, Time } from '@/utils.ts'; +import { eventAge, isRelay, nostrDate, Time } from '@/utils.ts'; import type { EventData } from '@/types.ts'; @@ -93,7 +93,7 @@ function trackRelays(event: Event) { } /** Determine if the event is being received in a timely manner. */ -const isFresh = ({ created_at }: Event): boolean => created_at >= nostrNow() - Time.seconds(10); +const isFresh = (event: Event): boolean => eventAge(event) < Time.seconds(10); /** Distribute the event through active subscriptions. */ function streamOut(event: Event, data: EventData) {