trends: catch initial queries

This commit is contained in:
Alex Gleason 2024-07-23 23:06:00 -05:00
parent 7949c95f77
commit 2b8009d840
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -9,7 +9,10 @@ import { generateDateRange, Time } from '@/utils/time.ts';
import { unfurlCardCached } from '@/utils/unfurl.ts'; import { unfurlCardCached } from '@/utils/unfurl.ts';
import { renderStatus } from '@/views/mastodon/statuses.ts'; import { renderStatus } from '@/views/mastodon/statuses.ts';
let trendingHashtagsCache = getTrendingHashtags(); let trendingHashtagsCache = getTrendingHashtags().catch((e) => {
console.error(`Failed to get trending hashtags: ${e}`);
return Promise.resolve([]);
});
Deno.cron('update trending hashtags cache', '35 * * * *', async () => { Deno.cron('update trending hashtags cache', '35 * * * *', async () => {
try { try {
@ -52,7 +55,10 @@ async function getTrendingHashtags() {
}); });
} }
let trendingLinksCache = getTrendingLinks(); let trendingLinksCache = getTrendingLinks().catch((e) => {
console.error(`Failed to get trending links: ${e}`);
return Promise.resolve([]);
});
Deno.cron('update trending links cache', '50 * * * *', async () => { Deno.cron('update trending links cache', '50 * * * *', async () => {
try { try {