Skip to content

Commit

Permalink
Filter old msgs while DB is backfilling
Browse files Browse the repository at this point in the history
  • Loading branch information
jmrossy committed Oct 9, 2024
1 parent 3d0674d commit 69734f2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/features/messages/queries/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ export function parseMessageStubResult(
.flat()
.map((m) => parseMessageStub(multiProvider, scrapedChains, m))
.filter((m): m is MessageStub => !!m)
.sort((a, b) => b.origin.timestamp - a.origin.timestamp);
.sort((a, b) => b.origin.timestamp - a.origin.timestamp)
.filter((m) => Date.now() - m.origin.timestamp < 1000 * 60 * 60) // filter out messages older than 1 hour
.slice(0, 20);
}

export function parseMessageQueryResult(
Expand Down
2 changes: 1 addition & 1 deletion src/features/messages/queries/useMessageQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { parseMessageQueryResult, parseMessageStubResult } from './parse';

const SEARCH_AUTO_REFRESH_DELAY = 15_000; // 15s
const MSG_AUTO_REFRESH_DELAY = 10_000; // 10s
const LATEST_QUERY_LIMIT = 20;
const LATEST_QUERY_LIMIT = 100;
const SEARCH_QUERY_LIMIT = 50;

export function isValidSearchQuery(input: string, allowAddress?: boolean) {
Expand Down

0 comments on commit 69734f2

Please sign in to comment.