log the scheduled function in work:start#171
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe change captures the schedule ID returned by Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/component/loop.ts`:
- Line 565: Declare scheduleId with the correct explicit type to satisfy strict
mode: change the untyped `let scheduleId;` to `let scheduleId:
Id<"_scheduled_functions">` (or the nullable/undefined variant if it can be
uninitialized) so it matches the expected parameter type for `recordStarted()`
and the function return `Promise<Id<"_scheduled_functions">>`; update any
control flow to initialize or narrow the type accordingly before passing it into
`recordStarted()` or returning it from the async function.
commit: |
ed93b4a to
21d679e
Compare

TL;DR
Added scheduled function ID tracking to work execution logging by capturing the return value from scheduler calls and passing it to the recordStarted function.
What changed?
beginWorkfunction to await and capture thescheduleIdfromctx.scheduler.runAfter()calls for both action and mutation/query function typesrecordStartedfunction signature to accept ascheduledFunctionIdparameterrecordStartedcall to after the scheduler operations complete so the schedule ID can be includedscheduledFunctionIdfield to the logged event dataHow to test?
Execute work items of different function types (actions, mutations, queries) and verify that the logged events now include the
scheduledFunctionIdfield with the correct scheduled function ID.Why make this change?
This enables better traceability and debugging by linking work execution events with their corresponding scheduled function entries, making it easier to track the lifecycle of work items through the scheduling system.
Summary by CodeRabbit