Skip to content

run onComplete inline always#190

Draft
ianmacartney wants to merge 3 commits into
mainfrom
ianmacartney/oncomplete-transactional
Draft

run onComplete inline always#190
ianmacartney wants to merge 3 commits into
mainfrom
ianmacartney/oncomplete-transactional

Conversation

@ianmacartney

@ianmacartney ianmacartney commented Apr 4, 2026

Copy link
Copy Markdown
Member

Instead of doing inline/inline -> schedule/schedule, let's do inline/inline -> schedule/inline, always running the onComplete handler inline in complete.ts so that the scheduler doesn't balloon with OCC-ing / retrying onComplete handlers while the workpool charges ahead.

Also write failed onComplete handlers for investigation / recovery purposes - though it'll be missing the full return value for now.

For un-catchable errors (e.g. the onComplete reads too much data) I think it would still wedge the workpool - but that's pre-existing and a bit orthogonal here

@coderabbitai

coderabbitai Bot commented Apr 4, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5b53f86f-885a-4ef9-ab88-e1b8c2926252

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ianmacartney/oncomplete-transactional

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ianmacartney ianmacartney requested a review from reeceyang April 4, 2026 03:25
@ianmacartney ianmacartney force-pushed the ianmacartney/oncomplete-transactional branch from 47efed5 to 7821e0b Compare April 4, 2026 03:29
@pkg-pr-new

pkg-pr-new Bot commented Apr 4, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/get-convex/workpool/@convex-dev/workpool@190

commit: 4e922a7

@reeceyang reeceyang 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.

this looks good!

Comment thread src/component/worker.ts
// Fall through and schedule complete instead (without running onComplete inline)
// Fall through and schedule complete instead
}
await ctx.scheduler.runAfter(0, internal.complete.complete, {

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.

I wonder if we should save the scheduled job id somewhere so that recovery can look it up if complete failed for an un-catchable reason (e.g. too many reads).

@ianmacartney ianmacartney force-pushed the ianmacartney/oncomplete-transactional branch from 520d751 to 4e922a7 Compare April 16, 2026 23:50
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