René's URL Explorer Experiment


Title: feat(schedule-engine): stop persisting per-tick schedule state by ericallam · Pull Request #3476 · triggerdotdev/trigger.dev · GitHub

Open Graph Title: feat(schedule-engine): stop persisting per-tick schedule state by ericallam · Pull Request #3476 · triggerdotdev/trigger.dev

X Title: feat(schedule-engine): stop persisting per-tick schedule state by ericallam · Pull Request #3476 · triggerdotdev/trigger.dev

Description: Summary Each scheduled-task tick previously issued 3 Prisma UPDATEs against TaskSchedule.lastRunTriggeredAt, TaskScheduleInstance.lastScheduledTimestamp, and TaskScheduleInstance.nextScheduledTimestamp. All three were pure denormalization — every value can be derived without persisting. After this PR TaskSchedule and TaskScheduleInstance become near read-only: writes happen only on schedule create / update / delete (rare admin actions), so the per-tick autovacuum churn on these hot tables disappears. Design The previous fire time travels forward through the schedule worker payload, not through the database. Concretely: The schedule.triggerScheduledTask worker payload gains an optional lastScheduleTime: z.coerce.date().optional() field. When the engine fires a schedule, it re-enqueues the next tick with lastScheduleTime = scheduleTimestamp (the just-fired time). When the next tick dequeues, payload.lastTimestamp is sourced from params.lastScheduleTime directly. No DB round-trip, no cron-derivation drift across DST boundaries, no caveats around recently-edited cron expressions. payload.lastTimestamp keeps its Date | undefined SDK shape. First-ever fires still report undefined, so customer if (!payload.lastTimestamp) first-run patterns keep working. For Redis jobs that were enqueued before this change (which lack lastScheduleTime in their payload), the engine falls back to instance.lastScheduledTimestamp once. Once those drain, the column is never read again. Revert is code-only; the columns stay in place and can be dropped in a follow-up once the rollout is stable. Files internal-packages/schedule-engine/* — engine refactor, workerCatalog schema field, TriggerScheduleParams extension, tests updated to assert on the worker-payload flow rather than DB readbacks. internal-packages/database/prisma/schema.prisma — /// @deprecated triple-slash docstrings on the three columns. No migration. apps/webapp/app/presenters/v3/ScheduleListPresenter.server.ts — drops the lastRunTriggeredAt Prisma select; "Last run" cell is approximated from the cron expression's previous slot, gated on schedule.createdAt so brand-new schedules show "–". UI is best-effort; the runs page is the source of truth. apps/webapp/app/v3/utils/calculateNextSchedule.server.ts — adds a previousScheduledTimestamp helper for the UI cell above. Public API responses (api.v1.schedules.*) already compute nextRun from cron and don't expose lastTimestamp — no public API change. references/scheduled-tasks/ — new reference project with declarative schedules at multiple cadences and three throw-on-fail validators (first-fire-detector, interval-validator, upcoming-validator) for E2E-verifying the worker-payload flow. Refs TRI-8891 Test plan pnpm run typecheck --filter @internal/schedule-engine --filter webapp pnpm run build --filter @trigger.dev/core pnpm run test --filter @internal/schedule-engine — integration test asserts first-fire lastTimestamp === undefined, second fire carries the previous fire's timestamp exactly. E2E against local webapp via references/scheduled-tasks: Fresh schedules attached → all three deprecated columns stay NULL after multiple fires. Redis payload at second fire contains "lastScheduleTime":"". TaskRun.payload and the every-minute task's returned output both confirm lastTimestamp = null on first fire and lastTimestamp = on second fire, exactly 60s apart. All three throw-on-FAIL validators completed successfully on every non-first fire. Schedules REST API end-to-end (POST / GET / PUT / activate / deactivate / DELETE) — nextRun recomputed live from cron + tz on every response, no reads of deprecated columns.

Open Graph Description: Summary Each scheduled-task tick previously issued 3 Prisma UPDATEs against TaskSchedule.lastRunTriggeredAt, TaskScheduleInstance.lastScheduledTimestamp, and TaskScheduleInstance.nextScheduledTimes...

X Description: Summary Each scheduled-task tick previously issued 3 Prisma UPDATEs against TaskSchedule.lastRunTriggeredAt, TaskScheduleInstance.lastScheduledTimestamp, and TaskScheduleInstance.nextScheduledTimes...

Opengraph URL: https://github.com/triggerdotdev/trigger.dev/pull/3476

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:31929617-5a29-0701-5290-dc9cdc7a51b5
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idEDDE:15E418:BFCD2:10F4C0:6AFAF2C0
html-safe-nonce21256ce7cc8aa9ee0c8fca41865bf9bb46fa4f81801bb4905e437308e1d94aa6
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRERFOjE1RTQxODpCRkNEMjoxMEY0QzA6NkFGQUYyQzAiLCJ2aXNpdG9yX2lkIjoiNzg1OTcwMzIyMzMzNjc2MDAwMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac72463c92c3fe9e86b26a9086a4d49e113a99ab43464b27943e7cbbe7360f79c3
hovercard-subject-tagpull_request:3608477866
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/triggerdotdev/trigger.dev/pull/3476/files
twitter:imagehttps://avatars.githubusercontent.com/u/534?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/534?s=400&v=4
og:image:altSummary Each scheduled-task tick previously issued 3 Prisma UPDATEs against TaskSchedule.lastRunTriggeredAt, TaskScheduleInstance.lastScheduledTimestamp, and TaskScheduleInstance.nextScheduledTimes...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None0178036d8230524a18422872393ab7e708443ae4c2047f758560a2db870c1913
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/triggerdotdev/trigger.dev git https://github.com/triggerdotdev/trigger.dev.git
octolytics-dimension-user_id95297378
octolytics-dimension-user_logintriggerdotdev
octolytics-dimension-repository_id572570113
octolytics-dimension-repository_nwotriggerdotdev/trigger.dev
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id572570113
octolytics-dimension-repository_network_root_nwotriggerdotdev/trigger.dev
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasea85e96a83bed7871993e6b1ffda24105928eee17
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/triggerdotdev/trigger.dev/pull/3476/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ftriggerdotdev%2Ftrigger.dev%2Fpull%2F3476%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ftriggerdotdev%2Ftrigger.dev%2Fpull%2F3476%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=triggerdotdev%2Ftrigger.dev
Reloadhttps://github.com/triggerdotdev/trigger.dev/pull/3476/files
Reloadhttps://github.com/triggerdotdev/trigger.dev/pull/3476/files
Reloadhttps://github.com/triggerdotdev/trigger.dev/pull/3476/files
triggerdotdevhttps://github.com/triggerdotdev
trigger.devhttps://github.com/triggerdotdev/trigger.dev
Codehttps://github.com/triggerdotdev/trigger.dev
Issues203 (203)https://github.com/triggerdotdev/trigger.dev/issues
Pull requests67 (67)https://github.com/triggerdotdev/trigger.dev/pulls
Discussionshttps://github.com/triggerdotdev/trigger.dev/discussions
Actionshttps://github.com/triggerdotdev/trigger.dev/actions
Projectshttps://github.com/triggerdotdev/trigger.dev/projects
Security and quality39 (39)https://github.com/triggerdotdev/trigger.dev/security
Insightshttps://github.com/triggerdotdev/trigger.dev/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Ftriggerdotdev%2Ftrigger.dev%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Ftriggerdotdev%2Ftrigger.dev%2Fissues%2Fnew%2Fchoose
ericallamhttps://github.com/ericallam
mainhttps://github.com/triggerdotdev/trigger.dev/tree/main
feature/tri-8891-stop-persisting-per-tick-schedule-engine-state-onhttps://github.com/triggerdotdev/trigger.dev/tree/feature/tri-8891-stop-persisting-per-tick-schedule-engine-state-on
Conversation 31 https://github.com/triggerdotdev/trigger.dev/pull/3476
Commits 8 https://github.com/triggerdotdev/trigger.dev/pull/3476/commits
Checks 45 https://github.com/triggerdotdev/trigger.dev/pull/3476/checks
Files changed https://github.com/triggerdotdev/trigger.dev/pull/3476/files
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/3476/files
feat(schedule-engine): stop persisting per-tick schedule state https://github.com/triggerdotdev/trigger.dev/pull/3476/files#top
Show all changes 8 commits https://github.com/triggerdotdev/trigger.dev/pull/3476/files
2d67c07 feat(schedule-engine): stop persisting per-tick schedule state ericallam Apr 30, 2026 https://github.com/triggerdotdev/trigger.dev/pull/3476/commits/2d67c07044640a6a6dce80d720ec4fda4fe197c6
23c99d8 fix(schedule-engine): split fromTimestamp from carried lastScheduleTime ericallam Apr 30, 2026 https://github.com/triggerdotdev/trigger.dev/pull/3476/commits/23c99d8b175672719f6d32dcdf9126567a7396b9
695eab1 fix(webapp): skip cron back-calc for inactive schedules in list ericallam Apr 30, 2026 https://github.com/triggerdotdev/trigger.dev/pull/3476/commits/695eab1a4b822c5e17b860f13637ffa15e008165
6765f63 fix(schedule-engine): seed lastScheduleTime on recovery via cron-prev ericallam Apr 30, 2026 https://github.com/triggerdotdev/trigger.dev/pull/3476/commits/6765f63e8c9f41a9413c8844aa52d4bc138868c1
db83e67 chore(schedule-engine): demote per-tick log lines to debug ericallam Apr 30, 2026 https://github.com/triggerdotdev/trigger.dev/pull/3476/commits/db83e67b6c5679e2fe9f260d26e157e591b82daf
cd5e629 fix(webapp): anchor schedules-list lastRun on updatedAt, not createdAt ericallam Apr 30, 2026 https://github.com/triggerdotdev/trigger.dev/pull/3476/commits/cd5e6299a21dcd6a38553ba49cd144e6900c2ada
c9569e7 test(schedule-engine): cover deploy-moment legacy-payload backward co… ericallam Apr 30, 2026 https://github.com/triggerdotdev/trigger.dev/pull/3476/commits/c9569e7341db93598c2b01dca8acc92e02412e6f
3910781 fix(schedule-engine): centralize lastScheduleTime cron-prev fallback ericallam Apr 30, 2026 https://github.com/triggerdotdev/trigger.dev/pull/3476/commits/39107817d84b05d825b06197c50a7f95ff37ae87
Clear filters https://github.com/triggerdotdev/trigger.dev/pull/3476/files
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/3476/files
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/3476/files
stop-persisting-schedule-tick-state.md https://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-36ea626f2e393a233969217577bf92ee38d470d4aa63136c4fb874d048d62e88
ScheduleListPresenter.server.ts https://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-c70007913b730e4320078707fa60cddb5f9947dc5a1bf9086c0fbf202cf6e4d8
calculateNextSchedule.server.ts https://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-9853a720dd9dd815c3d1a87f66a91eaa874ea40dff49f3f2197dce890b0fa854
schema.prisma https://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-6b8eefc1da429865c9493bbac9d2c4d00d1cfe2f2231f6474b9692f13b88e419
index.ts https://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-f5cfbcdb04abbee4d20c632b2b01538d90a52f829dff07e8b4264b3aa0b02e15
scheduleCalculation.ts https://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-0940660cb1d4a6b40df219bb62c448994f373cc82d7466016f99f93a2824985a
types.ts https://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-9a8c0cbc2598f5d55cc4b952f76cc14922290b4f2ccce2369b8ec4d772264719
workerCatalog.ts https://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-a60490466783a0a43c6107d4223e0bece856ad51dd8d94b9a20412726e4c5596
scheduleEngine.test.ts https://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-523e400b2770725900ebbdf28d9ec684f9538e4a29e99206267c88c70534725d
scheduleRecovery.test.ts https://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-9a47d1d91de4ab0fb33cf548a1eb57b1ca8abf75aeb8d05188c432b9bb1c5f8a
pnpm-lock.yaml https://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-32824c984905bb02bc7ffcef96a77addd1f1602cff71a11fbbfdd7f53ee026bb
README.md https://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-52f5d6ea38d55544af9c764900104cc154cbcbed768e90ea1b8fe5d97589dedf
package.json https://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-c2e417ec9afd877294143d23b52fcb90992a6b2fe74e5d2d83d7bf5550c4c701
schedules.ts https://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-d53ad82ab584bdf7eb069cfe357a1dcfab08789514003f03d361ead899ac1544
trigger.config.ts https://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-bdbe45107df64bdd671c5367088f52e252bba6d2471f520922cea0582fa370c8
tsconfig.json https://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-3ca62e6ab937e7b89cb757d8ea779a405df43c69d35ed573250e71fe1382816d
.server-changes/stop-persisting-schedule-tick-state.mdhttps://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-36ea626f2e393a233969217577bf92ee38d470d4aa63136c4fb874d048d62e88
View file https://github.com/triggerdotdev/trigger.dev/blob/39107817d84b05d825b06197c50a7f95ff37ae87/.server-changes/stop-persisting-schedule-tick-state.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/triggerdotdev/trigger.dev/pull/3476/{{ revealButtonHref }}
apps/webapp/app/presenters/v3/ScheduleListPresenter.server.tshttps://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-c70007913b730e4320078707fa60cddb5f9947dc5a1bf9086c0fbf202cf6e4d8
View file https://github.com/triggerdotdev/trigger.dev/blob/39107817d84b05d825b06197c50a7f95ff37ae87/apps/webapp/app/presenters/v3/ScheduleListPresenter.server.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/triggerdotdev/trigger.dev/pull/3476/{{ revealButtonHref }}
https://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-c70007913b730e4320078707fa60cddb5f9947dc5a1bf9086c0fbf202cf6e4d8
https://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-c70007913b730e4320078707fa60cddb5f9947dc5a1bf9086c0fbf202cf6e4d8
https://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-c70007913b730e4320078707fa60cddb5f9947dc5a1bf9086c0fbf202cf6e4d8
https://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-c70007913b730e4320078707fa60cddb5f9947dc5a1bf9086c0fbf202cf6e4d8
https://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-c70007913b730e4320078707fa60cddb5f9947dc5a1bf9086c0fbf202cf6e4d8
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/3476/files
https://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-c70007913b730e4320078707fa60cddb5f9947dc5a1bf9086c0fbf202cf6e4d8
https://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-c70007913b730e4320078707fa60cddb5f9947dc5a1bf9086c0fbf202cf6e4d8
apps/webapp/app/v3/utils/calculateNextSchedule.server.tshttps://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-9853a720dd9dd815c3d1a87f66a91eaa874ea40dff49f3f2197dce890b0fa854
View file https://github.com/triggerdotdev/trigger.dev/blob/39107817d84b05d825b06197c50a7f95ff37ae87/apps/webapp/app/v3/utils/calculateNextSchedule.server.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/triggerdotdev/trigger.dev/pull/3476/{{ revealButtonHref }}
https://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-9853a720dd9dd815c3d1a87f66a91eaa874ea40dff49f3f2197dce890b0fa854
https://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-9853a720dd9dd815c3d1a87f66a91eaa874ea40dff49f3f2197dce890b0fa854
internal-packages/database/prisma/schema.prismahttps://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-6b8eefc1da429865c9493bbac9d2c4d00d1cfe2f2231f6474b9692f13b88e419
View file https://github.com/triggerdotdev/trigger.dev/blob/39107817d84b05d825b06197c50a7f95ff37ae87/internal-packages/database/prisma/schema.prisma
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/triggerdotdev/trigger.dev/pull/3476/{{ revealButtonHref }}
https://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-6b8eefc1da429865c9493bbac9d2c4d00d1cfe2f2231f6474b9692f13b88e419
https://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-6b8eefc1da429865c9493bbac9d2c4d00d1cfe2f2231f6474b9692f13b88e419
https://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-6b8eefc1da429865c9493bbac9d2c4d00d1cfe2f2231f6474b9692f13b88e419
https://github.com/triggerdotdev/trigger.dev/pull/3476/files#diff-6b8eefc1da429865c9493bbac9d2c4d00d1cfe2f2231f6474b9692f13b88e419
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/3476/files
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/3476/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.