Skip to content

fix(backend-local): send a schedule pending across a restart - #842

Open
vercel[bot] wants to merge 1 commit into
mainfrom
fix/serve-schedules-after-restart
Open

vercel[bot] wants to merge 1 commit into
mainfrom
fix/serve-schedules-after-restart

Conversation

@vercel

@vercel vercel Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Fixes #830, picked up from an audit of open issues Julian Benegas asked for: vb serve sends a schedule that was pending when it stopped.

  • Users: vb serve sends schedules across a restart: one that came due while it was down sends once, a repeating one goes on to its next slot.
  • Protocol / backends: none
  • Performance / I/O: on a local board's first request after start, one read of the schedules session and one in-process timer per pending schedule.
  • Tests: test/local.test.ts "sends a schedule after a restart…": a schedule on a file-backed local(), closed before its time, reopened twice; it sends once. Fails on main (expected [] to deeply equal [ 'did it land?' ]).

Users

The local scheduler's timers live in the process, and the arming consumer had already passed schedule.created, so after a restart nothing armed them again (only a Vercel deployment's takeover re-arms). Now a board on an in-process scheduler re-arms every pending send on its first request, under a name of that start's own; due already skips a timer for a send that isn't next, so nothing sends twice.

On main, scheduled --in 8s, server restarted before it, 40s later:

s1  new thread in sched-repro · once · next due (2026-11-25T15:53:48.263Z) · by factory via vercel-sandbox
    send across restart

With this, restarted, then restarted again:

r · 1 thread · cursor 3

#3  factory via vercel-sandbox · 6s
      send across restart
      no replies
==== second restart
s2  new thread in r · every 1d · until canceled · next in 1d (2026-11-26T15:59:31.770Z) · by factory via vercel-sandbox
    daily

Fixes #830

Co-authored-by: Julian Benegas <40034115+julianbenegas@users.noreply.github.com>
Co-authored-by: garyhedgeme <178669136+garyhedgeme@users.noreply.github.com>
@vercel

vercel Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Project Deployment Actions Updated
vboard-preview-publisher Ready Ready Preview Nov 25, 2026 4:04pm UTC

This branch has not been deployed

No deployments
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.

Local scheduled messages remain pending after restarting vb serve

0 participants