Skip to content

feat(schedules): run jshvn/apartments every 4 hours, jittered - #12

Merged
jshvn merged 1 commit into
mainfrom
josh/apartments-every4h
Sep 24, 2026
Merged

jshvn merged 1 commit into
mainfrom
josh/apartments-every4h

Conversation

@jshvn

@jshvn jshvn commented Sep 24, 2026

Copy link
Copy Markdown
Owner

What

  • New every4h slot, 2 */4 * * * UTC, replacing hourly. hourly had no targets; with every4h it would have been a sixth slot, and the tests hold SLOTS at five, the free plan's cron budget.
  • JITTER: a slot can wait a random [0, n) minutes before dispatching. every4h waits up to 30, so each run starts between :02 and :32, about 15 minutes either side of :17. The delay is drawn inside step.do, so a restarted instance keeps its draw, and slept with step.sleep, which costs no CPU. That adds two steps per firing.
  • Registers jshvn/apartments watch.yml in every4h. It pings no healthcheck by choice: failed runs comment on its report issue. The rule in schedules/index.ts and the README checklist now allow "or say what alerts instead".
  • wrangler.jsonc regenerated by task crons: 17 5 * * * and 2 */4 * * *, 2 of 5.

Before merging

  • The GitHub App's installation on jshvn must include jshvn/apartments (Settings -> Applications -> Installed GitHub Apps). Otherwise every4h fails its step with App is not installed.
  • Merging deploys to Cloudflare. A new cron can take up to 15 minutes to start firing.

Test plan

  • task check: types, biome, 46 vitest tests, wrangler deploy --dry-run
  • New test: a jittered slot runs pick a delay, then sleep jitter, then its dispatches, with the sleep under 30 minutes. It fails with JITTER emptied.
  • Existing test: the unjittered evening slot runs only dispatch steps.
  • jshvn/apartments watch.yml already verified with a manual workflow_dispatch (run 36074952086).
  • After merge: task instances shows an every4h instance sleeping, then dispatching.

@jshvn
jshvn merged commit 3d5bccf into main Sep 24, 2026
1 check passed
@jshvn
jshvn deleted the josh/apartments-every4h branch September 24, 2026 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant