Skip to content

Refactor ScheduleJobAsync to use ScheduleJobRequest struct#9908

Merged
ReubenBond merged 4 commits into
mainfrom
copilot/refactor-schedulejobasync-arguments
Feb 17, 2026
Merged

Refactor ScheduleJobAsync to use ScheduleJobRequest struct#9908
ReubenBond merged 4 commits into
mainfrom
copilot/refactor-schedulejobasync-arguments

Conversation

Copilot AI commented Feb 12, 2026

Copy link
Copy Markdown
Contributor

ILocalDurableJobManager.ScheduleJobAsync took 4 individual parameters before the CancellationToken, making future API evolution breaking. Consolidated into a ScheduleJobRequest struct for extensibility.

Changes

  • Added ScheduleJobRequest struct with Target, JobName, DueTime, and Metadata properties
  • Updated method signatures:
    • ILocalDurableJobManager.ScheduleJobAsync(ScheduleJobRequest, CancellationToken)
    • IJobShard.TryScheduleJobAsync(ScheduleJobRequest, CancellationToken)
  • Updated implementations in LocalDurableJobManager and JobShard
  • Updated all call sites across test grains, test runners, and documentation

Example

Before:

await _jobManager.ScheduleJobAsync(
    this.GetGrainId(),
    "SendNotification",
    sendTime,
    metadata,
    CancellationToken.None);

After:

await _jobManager.ScheduleJobAsync(
    new ScheduleJobRequest
    {
        Target = this.GetGrainId(),
        JobName = "SendNotification",
        DueTime = sendTime,
        Metadata = metadata
    },
    CancellationToken.None);

New properties can now be added to ScheduleJobRequest without 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

Copilot AI changed the title [WIP] Refactor non-CancellationToken arguments in ScheduleJobAsync Refactor ScheduleJobAsync to use ScheduleJobRequest struct Feb 12, 2026
Copilot AI requested a review from benjaminpetit February 12, 2026 13:10
@benjaminpetit benjaminpetit mentioned this pull request Feb 12, 2026
14 tasks
@benjaminpetit benjaminpetit marked this pull request as ready for review February 12, 2026 15:55
Copilot AI review requested due to automatic review settings February 12, 2026 15:55

Copilot AI 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.

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 ScheduleJobRequest struct with Target, JobName, DueTime, and Metadata properties
  • Updated method signatures in ILocalDurableJobManager and IJobShard to 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

Comment thread src/Orleans.DurableJobs/README.md Outdated
Comment thread src/Azure/Orleans.DurableJobs.AzureStorage/README.md Outdated
Comment thread src/Orleans.DurableJobs/JobShard.cs
Comment thread test/Extensions/TesterAzureUtils/DurableJobs/AzureStorageJobShardBatchingTests.cs Outdated
Comment thread test/Tester/DurableJobs/JobShardManagerTestsRunner.cs Outdated
Comment thread test/Tester/DurableJobs/JobShardManagerTestsRunner.cs Outdated
@ReubenBond ReubenBond enabled auto-merge February 15, 2026 17:22
@ReubenBond ReubenBond disabled auto-merge February 15, 2026 20:59
@ReubenBond ReubenBond added this pull request to the merge queue Feb 15, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Feb 15, 2026
@ReubenBond ReubenBond added this pull request to the merge queue Feb 15, 2026
@ReubenBond ReubenBond removed this pull request from the merge queue due to a manual request Feb 15, 2026
@ReubenBond ReubenBond force-pushed the copilot/refactor-schedulejobasync-arguments branch from 5bc29d5 to 4726ad6 Compare February 15, 2026 21:35
@ReubenBond ReubenBond enabled auto-merge February 15, 2026 21:35
@ReubenBond ReubenBond disabled auto-merge February 15, 2026 21:35
@ReubenBond ReubenBond added this pull request to the merge queue Feb 16, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Feb 16, 2026
@ReubenBond ReubenBond added this pull request to the merge queue Feb 16, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Feb 16, 2026
@ReubenBond ReubenBond added this pull request to the merge queue Feb 16, 2026
@ReubenBond ReubenBond removed this pull request from the merge queue due to a manual request Feb 16, 2026
@ReubenBond ReubenBond added this pull request to the merge queue Feb 16, 2026
@ReubenBond ReubenBond removed this pull request from the merge queue due to a manual request Feb 16, 2026
@ReubenBond ReubenBond force-pushed the copilot/refactor-schedulejobasync-arguments branch from 4726ad6 to 9ccbcc1 Compare February 16, 2026 21:54
@ReubenBond ReubenBond enabled auto-merge February 16, 2026 21:54
@ReubenBond ReubenBond added this pull request to the merge queue Feb 16, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Feb 16, 2026
Copilot AI and others added 4 commits February 16, 2026 15:05
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>
@ReubenBond ReubenBond force-pushed the copilot/refactor-schedulejobasync-arguments branch from 9ccbcc1 to 6240fcc Compare February 16, 2026 23:07
@ReubenBond ReubenBond enabled auto-merge February 16, 2026 23:15
@ReubenBond ReubenBond added this pull request to the merge queue Feb 16, 2026
Merged via the queue into main with commit d60b6d5 Feb 17, 2026
59 checks passed
@ReubenBond ReubenBond deleted the copilot/refactor-schedulejobasync-arguments branch February 17, 2026 01:11
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>
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants