Skip to content

[integrations] apscheduler - driver - #212

Merged
ricardo-agz merged 3 commits into
mainfrom
ricardo/aps-1-driver
Aug 4, 2026
Merged

[integrations] apscheduler - driver#212
ricardo-agz merged 3 commits into
mainfrom
ricardo/aps-1-driver

Conversation

@ricardo-agz

@ricardo-agz ricardo-agz commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Bottom of the APScheduler stack. One Redis hash per deployment and scheduler, updated only through Lua scripts, guarantees a single chain of wake messages:

a wake message does not represent one job
a wake message asks the scheduler to evaluate all jobs at logical time T

Each wake must claim the current token (generation + sequence) before doing work, and finishing reserves exactly one successor. That one rule is what makes everything safe:

  • Spamming start() converges on one generation. pause() fences it; resume() starts a new one, so stale messages can never run.
  • A crash before publishing the successor leaves a pending token that the next delivery repairs.
  • No heartbeats: nothing scheduled means no messages at all.

No APScheduler code here; the adapter is the next PR. SCHEDULER.md has the full state machine and race table. Tests run the real Lua against a disposable Redis (APSCHEDULER_TEST_REDIS_URL).

Also: redis becomes an external bundle dependency (it can't be namespace-vendored, and apps import it directly anyway).

@vercel

vercel Bot commented Jul 31, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
vercel-py Ready Ready Preview Aug 4, 2026 5:20pm

Request Review

@socket-security

socket-security Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedpypi/​redis@​6.4.099100100100100

View full report

@ricardo-agz ricardo-agz changed the title ricardo/aps 1 driver [integrations] apscheduler - driver Jul 31, 2026
@ricardo-agz
ricardo-agz force-pushed the ricardo/aps-1-driver branch from 9d54dfa to 345fe35 Compare July 31, 2026 21:37
@ricardo-agz
ricardo-agz force-pushed the ricardo/aps-1-driver branch from 345fe35 to 87ec83c Compare July 31, 2026 22:37
Introduce the vercel-apscheduler package with its Redis-backed state
machine: one atomically fenced generation/sequence wake chain per
deployment and scheduler, with typed finish outcomes (advanced, fenced,
lost), an active-owner lease, dormancy when nothing is scheduled, and
stable Queue payloads. The APScheduler adapter that publishes and
consumes wake messages lands separately.
redis-py's dotted self-imports cannot be rewritten for namespace
vendoring, and applications import redis directly to configure the job
store's connection pool, so the bundle keeps the ordinary bounded
dependency instead of vendoring it.
The driver's Lua state-machine tests skip without
APSCHEDULER_TEST_REDIS_URL, so CI was only exercising the payload and
time helpers. Add a Redis service and point the tests at it.
@ricardo-agz
ricardo-agz merged commit 2f31470 into main Aug 4, 2026
22 of 24 checks passed
@ricardo-agz
ricardo-agz deleted the ricardo/aps-1-driver branch August 4, 2026 20:56
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.

2 participants