Website 1.4.0: nightly database backups and background jobs

As Accounts and Cross Events: a gzipped pg_dump every night (02:20) into
backend/backups/, the same website-*.sql.gz files crosscode makes before
updates, with Admin -> Backups (back up now, download, how many to keep).
The heartbeat, event feed and YouTube move from plain timers onto pg-boss
with the backup, and Admin -> Background jobs switches each on or off,
changes its schedule or runs it now. The heartbeat now reports the newest
backup (before: always none, so the Hub warned) and the real job state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-27 09:47:30 +02:00
co-authored by Claude Opus 5.5
parent 8e52bd2d33
commit a3ac3da5a5
20 changed files with 1050 additions and 52 deletions
-10
View File
@@ -99,13 +99,3 @@ export async function syncYoutube(ctx: Ctx, fetcher: Fetcher = (u) => fetch(u, {
return { added };
}
/** Every hour while the site runs (pg-boss comes with the other jobs). */
export function startYoutubeSync(ctx: Ctx): () => void {
if (!ctx.config.jobsEnabled) return () => {};
const run = () => syncYoutube(ctx).catch((e) => console.warn('[youtube]', (e as Error).message));
const first = setTimeout(run, 30_000);
const timer = setInterval(run, 60 * 60 * 1000);
first.unref?.();
timer.unref?.();
return () => { clearTimeout(first); clearInterval(timer); };
}