Refactor ScheduleJobAsync to use ScheduleJobRequest struct#9908
Merged
Conversation
Copilot
AI
changed the title
[WIP] Refactor non-CancellationToken arguments in ScheduleJobAsync
Refactor ScheduleJobAsync to use ScheduleJobRequest struct
Feb 12, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the ScheduleJobAsync API to improve extensibility by consolidating multiple parameters into a ScheduleJobRequest struct. This change prevents future API breaking changes when adding new properties, following a common pattern for evolving public APIs.
Changes:
- Introduced
ScheduleJobRequeststruct withTarget,JobName,DueTime, andMetadataproperties - Updated method signatures in
ILocalDurableJobManagerandIJobShardto accept the struct instead of individual parameters - Updated all implementations and call sites across test grains, test runners, and documentation
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Orleans.DurableJobs/ScheduleJobRequest.cs | New struct defining the job scheduling request with required properties and optional metadata |
| src/Orleans.DurableJobs/ILocalDurableJobManager.cs | Updated interface to accept ScheduleJobRequest instead of individual parameters |
| src/Orleans.DurableJobs/LocalDurableJobManager.cs | Updated implementation to extract values from the request struct |
| src/Orleans.DurableJobs/JobShard.cs | Updated interface and implementation to use ScheduleJobRequest |
| src/Orleans.DurableJobs/README.md | Updated documentation examples to show new API usage (contains syntax error) |
| src/Azure/Orleans.DurableJobs.AzureStorage/README.md | Updated Azure-specific documentation examples (contains syntax error) |
| test/Grains/TestGrains/DurableJobGrain.cs | Updated test grain to construct ScheduleJobRequest |
| test/Grains/TestGrains/RetryTestGrain.cs | Updated test grain to construct ScheduleJobRequest |
| test/Grains/TestGrains/SchedulerGrain.cs | Updated test grain to construct ScheduleJobRequest |
| test/Tester/DurableJobs/JobShardManagerTestsRunner.cs | Updated test runner to use new struct initialization syntax |
| test/Extensions/TesterAzureUtils/DurableJobs/AzureStorageJobShardBatchingTests.cs | Updated Azure storage tests to use new struct initialization syntax |
5bc29d5 to
4726ad6
Compare
4726ad6 to
9ccbcc1
Compare
Co-authored-by: benjaminpetit <20427417+benjaminpetit@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
9ccbcc1 to
6240fcc
Compare
rkargMsft
pushed a commit
to rkargMsft/orleans
that referenced
this pull request
Feb 27, 2026
* Add ScheduleJobRequest struct and update interfaces Co-authored-by: benjaminpetit <20427417+benjaminpetit@users.noreply.github.com> * Address PR feedback on ScheduleJobRequest refactor Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix JobShard out-of-range param name Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix durable jobs test scheduling call shape Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: benjaminpetit <20427417+benjaminpetit@users.noreply.github.com> Co-authored-by: Reuben Bond <reuben.bond@gmail.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ILocalDurableJobManager.ScheduleJobAsynctook 4 individual parameters before theCancellationToken, making future API evolution breaking. Consolidated into aScheduleJobRequeststruct for extensibility.Changes
ScheduleJobRequeststruct withTarget,JobName,DueTime, andMetadatapropertiesILocalDurableJobManager.ScheduleJobAsync(ScheduleJobRequest, CancellationToken)IJobShard.TryScheduleJobAsync(ScheduleJobRequest, CancellationToken)LocalDurableJobManagerandJobShardExample
Before:
After:
New properties can now be added to
ScheduleJobRequestwithout changing method signatures.💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.
Microsoft Reviewers: Open in CodeFlow