Skip to content

Commit

Permalink
Update dependencies, add more logging to crons
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunoBernardino committed Apr 17, 2024
1 parent bcf54f1 commit 7fd29ba
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .dvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.41.3
1.42.4
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM denoland/deno:ubuntu-1.41.3
FROM denoland/deno:ubuntu-1.42.4

EXPOSE 8000

Expand Down
6 changes: 4 additions & 2 deletions crons/cleanup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
Expand All @@ -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);
}
}
2 changes: 1 addition & 1 deletion crons/index.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
6 changes: 4 additions & 2 deletions crons/news.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
10 changes: 5 additions & 5 deletions import_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
}
}
2 changes: 1 addition & 1 deletion routes/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
4 changes: 2 additions & 2 deletions routes/settings.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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} />
Expand Down

0 comments on commit 7fd29ba

Please sign in to comment.