-
Notifications
You must be signed in to change notification settings - Fork 325
Adding new logic for extended sessions to enable the DTS use-case #1333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ | |
| // limitations under the License. | ||
| // ---------------------------------------------------------------------------------- | ||
|
|
||
| #nullable enable | ||
| namespace DurableTask.Core | ||
| { | ||
| using System.Collections.Generic; | ||
|
|
@@ -30,5 +31,11 @@ public interface IOrchestrationSession | |
| /// and the dispatcher will shut down the session. | ||
| /// </remarks> | ||
| Task<IList<TaskMessage>> FetchNewOrchestrationMessagesAsync(TaskOrchestrationWorkItem workItem); | ||
|
|
||
| /// <summary> | ||
| /// Ends the session. | ||
| /// </summary> | ||
| /// <returns>A task that completes when the session has been ended.</returns> | ||
| Task EndSessionAsync(); | ||
|
Comment on lines
+35
to
+39
|
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -295,6 +295,7 @@ async Task OnProcessWorkItemSessionAsync(TaskOrchestrationWorkItem workItem) | |||||||||||
| "OnProcessWorkItemSession-Release", | ||||||||||||
| $"Releasing extended session after {processCount} batch(es)."); | ||||||||||||
| this.concurrentSessionLock.Release(); | ||||||||||||
| await workItem.Session.EndSessionAsync(); | ||||||||||||
| } | ||||||||||||
|
Comment on lines
295
to
299
|
||||||||||||
| } | ||||||||||||
| } | ||||||||||||
|
|
@@ -553,10 +554,6 @@ protected async Task<bool> OnProcessWorkItemAsync(TaskOrchestrationWorkItem work | |||||||||||
| orchestratorMessages.AddRange(subOrchestrationRewindMessages); | ||||||||||||
| workItem.OrchestrationRuntimeState = newRuntimeState; | ||||||||||||
| runtimeState = newRuntimeState; | ||||||||||||
|
||||||||||||
| runtimeState = newRuntimeState; | |
| runtimeState = newRuntimeState; | |
| // Mark this session as rewinding/interrupted so the extended session loop terminates | |
| isRewinding = true; | |
| isInterrupted = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With
#nullable enableenabled in this file,FetchNewOrchestrationMessagesAsyncis documented to allow returningnullto end the session, but the signature returns a non-nullableTask<IList<TaskMessage>>. Consider updating the return type annotation toTask<IList<TaskMessage>?>(nullable reference annotation only) so implementers using nullable analysis don’t get misleading contracts/warnings and the signature matches the documented behavior.