Skip to content

[apscheduler] store one cache record per declared job - #290

Open
ricardo-agz wants to merge 1 commit into
ricardo/aps-preview-idle-failsafefrom
ricardo/aps-per-job-records
Open

[apscheduler] store one cache record per declared job#290
ricardo-agz wants to merge 1 commit into
ricardo/aps-preview-idle-failsafefrom
ricardo/aps-per-job-records

Conversation

@ricardo-agz

@ricardo-agz ricardo-agz commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Replaces the single jobs document in Runtime Cache with one record per declared job.

Rationale:

Since jobs are static, the code is the source of truth for the jobs, meaning that the job ids are known at import time so an index store is no longer needed.

Reconciliation becomes read-repair: a record that is missing, unreadable, or fingerprinted for a different declared schedule is rebuilt from its declaration at the point of use, owner-fenced, with a log line that makes cache eviction observable in production. A demoted deployment's reads degrade to a declaration-derived view without writing.

What this buys

  • A write race involves one job's record, never its neighbors (the whole-document last-writer-wins clobber is gone).
  • Eviction costs one job's progress, not the population's, and each job heals independently.
  • The cache's per-item size limit no longer bounds the job count.
  • Takeover syncs to the new code's declarations lazily: an undeclared job is unreachable by construction, a changed trigger restarts on first read, an unchanged job keeps its progress.

Deleted machinery

The takeover reconciliation sweep, its convergence retries, the reconciled_deployment marker (and its document fate-sharing trick), and the quarantine path all go away — every read validates against code, so there is nothing left to sweep, stamp, or quarantine.

Old single-document keys are simply never read again and age out by TTL; state rebuilds from code, so there is no migration.

@vercel

vercel Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
vercel-py Ready Ready Preview Aug 12, 2026 2:22am

Request Review

@ricardo-agz
ricardo-agz force-pushed the ricardo/aps-per-job-records branch from c255deb to 6df1f4f Compare August 12, 2026 02:06
@ricardo-agz
ricardo-agz force-pushed the ricardo/aps-per-job-records branch from 6df1f4f to 7f1b955 Compare August 12, 2026 02:17
@ricardo-agz
ricardo-agz force-pushed the ricardo/aps-per-job-records branch from 7f1b955 to 345c7a8 Compare August 12, 2026 02:22
The single jobs document coupled every job's fate: one lost
read-merge-write race could clobber unrelated progress, eviction was
all-or-nothing, and the cache's per-item size limit bounded the
population. Declared-only made the document unnecessary: code is the
index, so each declared job now has its own record and reads
enumerate the declared ids.

Reconciliation becomes read-repair. A record that is missing,
unreadable, or fingerprinted for a different declared schedule is
rebuilt from its declaration at the point of use, owner-fenced, with
a log line that makes eviction observable. The takeover sweep, its
convergence marker, and the quarantine machinery all delete;
takeover syncs lazily because every read validates against code.
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