Skip to content

Replace client-triggered cron with built-in serverside scheduler#34

Merged
hawkinslabdev merged 1 commit into
mainfrom
issues/33
May 16, 2026
Merged

Replace client-triggered cron with built-in serverside scheduler#34
hawkinslabdev merged 1 commit into
mainfrom
issues/33

Conversation

@hawkinslabdev
Copy link
Copy Markdown
Owner

Previously, the workflow checks only fired when a user visited the app, so notifications were missed during idle periods. A built-in setInterval scheduler now runs `runWorkflowChecks() for all users on server startup and every 1 hour.

  • Add src/lib/server/scheduler.ts with Symbol.for guards and a running lock (no overlapping ticks)
  • Timer is unref'd so graceful shutdown is not blocked

Closes #33

…cheduler

Workflow checks only fired when a user visited the app, so notifications
were missed during idle periods. A built-in setInterval scheduler now
runs runWorkflowChecks() for all users on server startup and every
CRON_INTERVAL_HOURS (default 1h), independent of user activity.

- Add src/lib/server/scheduler.ts with Symbol.for guards (no double-init
  on HMR) and a running lock (no overlapping ticks)
- Timer is unref'd so graceful shutdown is not blocked
- Remove CRON_SECRET external-cron auth path from check endpoint;
  the endpoint remains for authenticated manual triggers only

Closes #33
@hawkinslabdev hawkinslabdev self-assigned this May 16, 2026
@hawkinslabdev hawkinslabdev added the bug Something isn't working label May 16, 2026
@hawkinslabdev hawkinslabdev merged commit ad3c4ef into main May 16, 2026
1 check passed
@hawkinslabdev hawkinslabdev deleted the issues/33 branch May 16, 2026 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move cron-job server-side

1 participant