queries: don't unnecessarily sort things

This commit is contained in:
Alex Gleason 2023-08-17 14:55:00 -05:00
parent 7330cd10e2
commit 4f37a1b9f8
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 4 additions and 6 deletions

View File

@ -1,5 +1,5 @@
import { type Event, type Filter, findReplyTag } from '@/deps.ts'; import { type Event, type Filter, findReplyTag } from '@/deps.ts';
import { eventDateComparator, type PaginationParams } from '@/utils.ts'; import { type PaginationParams } from '@/utils.ts';
import { getFilters as getFiltersMixer } from './mixer.ts'; import { getFilters as getFiltersMixer } from './mixer.ts';
@ -53,14 +53,12 @@ async function getFeed(pubkey: string, params: PaginationParams): Promise<Event<
...params, ...params,
}; };
const results = await getFiltersMixer([filter], { timeout: 5000 }); return getFiltersMixer([filter], { timeout: 5000 });
return results.sort(eventDateComparator);
} }
/** Get a feed of all known text notes. */ /** Get a feed of all known text notes. */
async function getPublicFeed(params: PaginationParams): Promise<Event<1>[]> { function getPublicFeed(params: PaginationParams): Promise<Event<1>[]> {
const results = await getFiltersMixer([{ kinds: [1], ...params }], { timeout: 5000 }); return getFiltersMixer([{ kinds: [1], ...params }], { timeout: 5000 });
return results.sort(eventDateComparator);
} }
async function getAncestors(event: Event<1>, result = [] as Event<1>[]): Promise<Event<1>[]> { async function getAncestors(event: Event<1>, result = [] as Event<1>[]): Promise<Event<1>[]> {