Skip to content

perf(scheduler): avoid unnecessary db roundtrip on task retirement#6810

Merged
ErickRDev merged 2 commits into
masterfrom
erickr/jul16/avoid-db-roundtrip-on-task-retirement
Jul 21, 2026
Merged

perf(scheduler): avoid unnecessary db roundtrip on task retirement#6810
ErickRDev merged 2 commits into
masterfrom
erickr/jul16/avoid-db-roundtrip-on-task-retirement

Conversation

@ErickRDev

@ErickRDev ErickRDev commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Actions, webhooks and on-event handlers are not scheduled and thus have no schedule id, so attempting to compute the schedule's next_execution_at timestamp is a no-op: the UPDATE's WHERE clause will never match a tuple for non-sync functions. This PR simply adds a runtime check to validate whether the task has a schedule id before calling scheduleNextExecution, thus avoiding the extra roundtrip incurred by the no-op query.

Review in cubic

Actions, webhooks and on-event handlers are not scheduled and thus have
no schedule id, so attempting to compute the schedule's
`next_execution_at` timestamp is a no-op as the `UPDATE` `WHERE` clause
will never match a tuple on this code path.

This PR simply adds a runtime check to validate whether the task has a
schedule id before calling `scheduleNextExecution`, thus avoiding the
no-op query for non-syncs.
@ErickRDev ErickRDev self-assigned this Jul 16, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@ErickRDev ErickRDev changed the title perf: avoid unnecessary db roundtrip on task retirement perf(scheduler): avoid unnecessary db roundtrip on task retirement Jul 17, 2026
@ErickRDev
ErickRDev marked this pull request as ready for review July 17, 2026 20:55
@ErickRDev
ErickRDev requested a review from a team July 17, 2026 21:07
Comment thread packages/scheduler/lib/scheduler.ts Outdated
@ErickRDev
ErickRDev added this pull request to the merge queue Jul 21, 2026
Merged via the queue into master with commit 47ac30c Jul 21, 2026
48 checks passed
@ErickRDev
ErickRDev deleted the erickr/jul16/avoid-db-roundtrip-on-task-retirement branch July 21, 2026 15:48
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