fix: avoid updating cache if event is old

This commit is contained in:
Shusui MOYATANI
2023-10-02 01:05:34 +09:00
parent 326acacfc8
commit ab171c0016
6 changed files with 174 additions and 19 deletions

View File

@@ -4,6 +4,7 @@ import uniqBy from 'lodash/uniqBy';
import { utils } from 'nostr-tools';
import useConfig from '@/core/useConfig';
import { sortEvents } from '@/nostr/event/comparator';
import usePool from '@/nostr/usePool';
import useStats from '@/nostr/useStats';
@@ -29,9 +30,6 @@ export type UseSubscriptionProps = {
debugId?: string;
};
const sortEvents = (events: NostrEvent[]) =>
Array.from(events).sort((a, b) => b.created_at - a.created_at);
let count = 0;
const { setActiveSubscriptions } = useStats();