mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
trends: Deno.cron try/catch
This commit is contained in:
parent
64eeee5ff7
commit
5ebde99320
2 changed files with 14 additions and 4 deletions
2
deno.lock
generated
2
deno.lock
generated
|
|
@ -148,7 +148,9 @@
|
||||||
"@nostrify/nostrify@0.27.0-rc.3": {
|
"@nostrify/nostrify@0.27.0-rc.3": {
|
||||||
"integrity": "0cd3d26bb0d797e95e74b301efc85f4262bd913df12644ff42494a97a02a6c0d",
|
"integrity": "0cd3d26bb0d797e95e74b301efc85f4262bd913df12644ff42494a97a02a6c0d",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
"jsr:@std/crypto@^0.224.0",
|
||||||
"jsr:@std/encoding@^0.224.1",
|
"jsr:@std/encoding@^0.224.1",
|
||||||
|
"npm:@scure/base@^1.1.6",
|
||||||
"npm:@scure/bip32@^1.4.0",
|
"npm:@scure/bip32@^1.4.0",
|
||||||
"npm:@scure/bip39@^1.3.0",
|
"npm:@scure/bip39@^1.3.0",
|
||||||
"npm:kysely@^0.27.3",
|
"npm:kysely@^0.27.3",
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,12 @@ import { renderStatus } from '@/views/mastodon/statuses.ts';
|
||||||
let trendingHashtagsCache = getTrendingHashtags();
|
let trendingHashtagsCache = getTrendingHashtags();
|
||||||
|
|
||||||
Deno.cron('update trending hashtags cache', '35 * * * *', async () => {
|
Deno.cron('update trending hashtags cache', '35 * * * *', async () => {
|
||||||
const trends = await getTrendingHashtags();
|
try {
|
||||||
trendingHashtagsCache = Promise.resolve(trends);
|
const trends = await getTrendingHashtags();
|
||||||
|
trendingHashtagsCache = Promise.resolve(trends);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const trendingTagsQuerySchema = z.object({
|
const trendingTagsQuerySchema = z.object({
|
||||||
|
|
@ -51,8 +55,12 @@ async function getTrendingHashtags() {
|
||||||
let trendingLinksCache = getTrendingLinks();
|
let trendingLinksCache = getTrendingLinks();
|
||||||
|
|
||||||
Deno.cron('update trending links cache', '50 * * * *', async () => {
|
Deno.cron('update trending links cache', '50 * * * *', async () => {
|
||||||
const trends = await getTrendingLinks();
|
try {
|
||||||
trendingLinksCache = Promise.resolve(trends);
|
const trends = await getTrendingLinks();
|
||||||
|
trendingLinksCache = Promise.resolve(trends);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const trendingLinksController: AppController = async (c) => {
|
const trendingLinksController: AppController = async (c) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue