From 3373673706e4df880286d4e17aef11f8ebf55136 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 2 Jun 2024 19:27:44 -0500 Subject: [PATCH] updateTrendingTags: accept limit param --- src/cron.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cron.ts b/src/cron.ts index aa19caf..0313e7d 100644 --- a/src/cron.ts +++ b/src/cron.ts @@ -46,7 +46,7 @@ async function updateTrendingNotes() { console.info('Trending notes updated.'); } -async function updateTrendingTags(tagName: string, extra = '') { +async function updateTrendingTags(tagName: string, limit: number, extra = '') { console.info(`Updating trending #${tagName}...`); const kysely = await DittoDB.getInstance(); const signal = AbortSignal.timeout(1000); @@ -57,7 +57,7 @@ async function updateTrendingTags(tagName: string, extra = '') { const trends = await getTrendingTagValues(kysely, tagName, { since: yesterday, until: now, - limit: 20, + limit, }); if (!trends.length) { @@ -84,6 +84,6 @@ async function updateTrendingTags(tagName: string, extra = '') { /** Start cron jobs for the application. */ export function cron() { Deno.cron('update trending notes', '15 * * * *', updateTrendingNotes); - Deno.cron('update trending hashtags', '30 * * * *', () => updateTrendingTags('t')); - Deno.cron('update trending links', '45 * * * *', () => updateTrendingTags('r')); + Deno.cron('update trending hashtags', '30 * * * *', () => updateTrendingTags('t', 20)); + Deno.cron('update trending links', '45 * * * *', () => updateTrendingTags('r', 20)); }