Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
+34
@@ -0,0 +1,34 @@
|
||||
// R-P5 (P5) §P2d — Apps-Engine maintenance crons: OAuth token refresh + health
|
||||
// sweep. Config + idempotent scheduler registration only; the execution logic
|
||||
// lives in handlers.ts (which holds the Prisma client), mirroring the task
|
||||
// retention/reminder crons.
|
||||
|
||||
export const INTEGRATIONS_TOKEN_REFRESH_JOB_ID = "integrations-token-refresh" as const;
|
||||
export const INTEGRATIONS_HEALTH_SWEEP_JOB_ID = "integrations-health-sweep" as const;
|
||||
|
||||
// Token refresh runs often (tokens expire); health sweep less often.
|
||||
export const INTEGRATIONS_TOKEN_REFRESH_EVERY_MS = 5 * 60 * 1000;
|
||||
export const INTEGRATIONS_HEALTH_SWEEP_EVERY_MS = 15 * 60 * 1000;
|
||||
|
||||
/** Refresh tokens expiring within this window. Default 10 minutes. */
|
||||
export const INTEGRATIONS_TOKEN_REFRESH_WINDOW_MINUTES = 10;
|
||||
|
||||
type SchedulerQueue = {
|
||||
upsertJobScheduler: (schedulerId: string, options: { every: number }, template: { name: string; data?: Record<string, unknown> }) => Promise<unknown>;
|
||||
};
|
||||
|
||||
export async function registerIntegrationsTokenRefreshCron(queue: SchedulerQueue): Promise<void> {
|
||||
await queue.upsertJobScheduler(
|
||||
INTEGRATIONS_TOKEN_REFRESH_JOB_ID,
|
||||
{ every: INTEGRATIONS_TOKEN_REFRESH_EVERY_MS },
|
||||
{ name: INTEGRATIONS_TOKEN_REFRESH_JOB_ID, data: { kind: "cleanup.run", task: INTEGRATIONS_TOKEN_REFRESH_JOB_ID, olderThanMinutes: INTEGRATIONS_TOKEN_REFRESH_WINDOW_MINUTES } },
|
||||
);
|
||||
}
|
||||
|
||||
export async function registerIntegrationsHealthSweepCron(queue: SchedulerQueue): Promise<void> {
|
||||
await queue.upsertJobScheduler(
|
||||
INTEGRATIONS_HEALTH_SWEEP_JOB_ID,
|
||||
{ every: INTEGRATIONS_HEALTH_SWEEP_EVERY_MS },
|
||||
{ name: INTEGRATIONS_HEALTH_SWEEP_JOB_ID, data: { kind: "cleanup.run", task: INTEGRATIONS_HEALTH_SWEEP_JOB_ID } },
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user