26 lines
1.6 KiB
TypeScript
26 lines
1.6 KiB
TypeScript
// SPDX-License-Identifier: LicenseRef-ConusAI-Template-1.0
|
|
// The module cron of this app: what the worker runs on a clock, not because anyone asked.
|
|
//
|
|
// A kit module declares its schedules beside its manifest (kit-core's manifest carries handlers and
|
|
// no timing); the composition root is what turns them on, so a module that is not in this list is
|
|
// not scheduled and the registry says so at boot (`installSchedules` refuses a schedule of a job no
|
|
// module declares). Without the first line nothing ever finishes an upload whose request died, and
|
|
// every crash boundary of the files module stays open however good its recovery is.
|
|
|
|
import { ACCOUNT_SCHEDULES } from "@app/modules/account"
|
|
import { FILES_SCHEDULES } from "@conusai-kit/files"
|
|
import { defineSchedules, type ModuleSchedule } from "@conusai-kit/jobs-pgboss"
|
|
|
|
export function appSchedules(): readonly ModuleSchedule[] {
|
|
return [
|
|
// `files.recover`, every five minutes, for every project of every active organization: the
|
|
// worker lists the projects through the global reader and enqueues one run for each.
|
|
...defineSchedules("files", FILES_SCHEDULES),
|
|
// `account.deletion.sweep`, every five minutes and in no organization: resumes an account deletion
|
|
// whose module erasure was unavailable (the deletion ledger is its whole state). And
|
|
// `account.sessions.revoke`, every minute: delivers the revocations of signed-out app sessions'
|
|
// derived service sessions that a module's platform has not confirmed (the revocation outbox).
|
|
...defineSchedules("account", ACCOUNT_SCHEDULES),
|
|
]
|
|
}
|