Update dependencies, add more logging to crons
This commit is contained in:
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@@ -9,7 +9,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: denoland/setup-deno@v1
|
- uses: denoland/setup-deno@v1
|
||||||
with:
|
with:
|
||||||
deno-version: v1.41.3
|
deno-version: v1.42.4
|
||||||
- run: |
|
- run: |
|
||||||
make test
|
make test
|
||||||
make build
|
make build
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM denoland/deno:ubuntu-1.41.3
|
FROM denoland/deno:ubuntu-1.42.4
|
||||||
|
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ export async function cleanupSessions() {
|
|||||||
const yesterday = new Date(new Date().setUTCDate(new Date().getUTCDate() - 1));
|
const yesterday = new Date(new Date().setUTCDate(new Date().getUTCDate() - 1));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
console.info('Will cleanup user sessions');
|
||||||
|
|
||||||
const result = await db.query<{ count: number }>(
|
const result = await db.query<{ count: number }>(
|
||||||
sql`WITH "deleted" AS (
|
sql`WITH "deleted" AS (
|
||||||
DELETE FROM "bewcloud_user_sessions" WHERE "expires_at" <= $1 RETURNING *
|
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) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 { cleanupSessions } from './cleanup.ts';
|
||||||
import { fetchNewArticles } from './news.ts';
|
import { fetchNewArticles } from './news.ts';
|
||||||
|
|||||||
@@ -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);
|
await concurrentPromises(feedsToCrawl.map((newsFeed) => () => crawlNewsFeed(newsFeed)), 3);
|
||||||
|
|
||||||
console.log('Crawled', feedsToCrawl.length, 'news feeds');
|
console.info('Crawled', feedsToCrawl.length, 'news feeds');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,10 +11,10 @@
|
|||||||
"preact/": "https://esm.sh/preact@10.19.6/",
|
"preact/": "https://esm.sh/preact@10.19.6/",
|
||||||
"@preact/signals": "https://esm.sh/*@preact/signals@1.2.2",
|
"@preact/signals": "https://esm.sh/*@preact/signals@1.2.2",
|
||||||
"@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.5.1",
|
"@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.5.1",
|
||||||
"tailwindcss": "npm:tailwindcss@3.4.1",
|
"tailwindcss": "npm:tailwindcss@3.4.3",
|
||||||
"tailwindcss/": "npm:/tailwindcss@3.4.1/",
|
"tailwindcss/": "npm:/tailwindcss@3.4.3/",
|
||||||
"tailwindcss/plugin": "npm:/tailwindcss@3.4.1/plugin.js",
|
"tailwindcss/plugin": "npm:/tailwindcss@3.4.3/plugin.js",
|
||||||
"std/": "https://deno.land/std@0.220.1/",
|
"std/": "https://deno.land/std@0.223.0/",
|
||||||
"$std/": "https://deno.land/std@0.220.1/"
|
"$std/": "https://deno.land/std@0.223.0/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.';
|
const initialNotes = data?.userDashboard?.data?.notes || 'Jot down some notes here.';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Handlers, PageProps } from 'fresh/server.ts';
|
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 { PASSWORD_SALT } from '/lib/auth.ts';
|
||||||
import {
|
import {
|
||||||
createVerificationCode,
|
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 (
|
return (
|
||||||
<main>
|
<main>
|
||||||
<Settings formData={data?.formData} error={data?.error} notice={data?.notice} />
|
<Settings formData={data?.formData} error={data?.error} notice={data?.notice} />
|
||||||
|
|||||||
Reference in New Issue
Block a user