Update dependencies, add more logging to crons

This commit is contained in:
Bruno Bernardino
2024-04-17 14:01:06 +01:00
parent bcf54f148e
commit 7fd29ba7bf
9 changed files with 20 additions and 16 deletions

2
.dvmrc
View File

@@ -1 +1 @@
1.41.3
1.42.4

View File

@@ -9,7 +9,7 @@ jobs:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
with:
deno-version: v1.41.3
deno-version: v1.42.4
- run: |
make test
make build

View File

@@ -1,4 +1,4 @@
FROM denoland/deno:ubuntu-1.41.3
FROM denoland/deno:ubuntu-1.42.4
EXPOSE 8000

View File

@@ -6,6 +6,8 @@ export async function cleanupSessions() {
const yesterday = new Date(new Date().setUTCDate(new Date().getUTCDate() - 1));
try {
console.info('Will cleanup user sessions');
const result = await db.query<{ count: number }>(
sql`WITH "deleted" AS (
DELETE FROM "bewcloud_user_sessions" WHERE "expires_at" <= $1 RETURNING *
@@ -16,8 +18,8 @@ export async function cleanupSessions() {
],
);
console.log('Deleted', result[0].count, 'user sessions');
console.info('Deleted', result[0].count, 'user sessions');
} catch (error) {
console.log(error);
console.error(error);
}
}

View File

@@ -1,4 +1,4 @@
import { Cron } from 'https://deno.land/x/croner@7.0.1/dist/croner.js';
import { Cron } from 'https://deno.land/x/croner@8.0.1/dist/croner.js';
import { cleanupSessions } from './cleanup.ts';
import { fetchNewArticles } from './news.ts';

View File

@@ -16,10 +16,12 @@ export async function fetchNewArticles(forceFetch = false) {
],
);
console.info('Will crawl', feedsToCrawl.length, 'news feeds');
await concurrentPromises(feedsToCrawl.map((newsFeed) => () => crawlNewsFeed(newsFeed)), 3);
console.log('Crawled', feedsToCrawl.length, 'news feeds');
console.info('Crawled', feedsToCrawl.length, 'news feeds');
} catch (error) {
console.log(error);
console.error(error);
}
}

View File

@@ -11,10 +11,10 @@
"preact/": "https://esm.sh/preact@10.19.6/",
"@preact/signals": "https://esm.sh/*@preact/signals@1.2.2",
"@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.5.1",
"tailwindcss": "npm:tailwindcss@3.4.1",
"tailwindcss/": "npm:/tailwindcss@3.4.1/",
"tailwindcss/plugin": "npm:/tailwindcss@3.4.1/plugin.js",
"std/": "https://deno.land/std@0.220.1/",
"$std/": "https://deno.land/std@0.220.1/"
"tailwindcss": "npm:tailwindcss@3.4.3",
"tailwindcss/": "npm:/tailwindcss@3.4.3/",
"tailwindcss/plugin": "npm:/tailwindcss@3.4.3/plugin.js",
"std/": "https://deno.land/std@0.223.0/",
"$std/": "https://deno.land/std@0.223.0/"
}
}

View File

@@ -25,7 +25,7 @@ export const handler: Handlers<Data, FreshContextState> = {
},
};
export default function Dashboard({ data }: PageProps<Data, FreshContextState>) {
export default function DashboardPage({ data }: PageProps<Data, FreshContextState>) {
const initialNotes = data?.userDashboard?.data?.notes || 'Jot down some notes here.';
return (

View File

@@ -1,6 +1,6 @@
import { Handlers, PageProps } from 'fresh/server.ts';
import { Dashboard, FreshContextState } from '/lib/types.ts';
import { FreshContextState } from '/lib/types.ts';
import { PASSWORD_SALT } from '/lib/auth.ts';
import {
createVerificationCode,
@@ -180,7 +180,7 @@ export const handler: Handlers<Data, FreshContextState> = {
},
};
export default function Dashboard({ data }: PageProps<Data, FreshContextState>) {
export default function SettingsPage({ data }: PageProps<Data, FreshContextState>) {
return (
<main>
<Settings formData={data?.formData} error={data?.error} notice={data?.notice} />