-
Notifications
You must be signed in to change notification settings - Fork 53
Extended Sessions for Isolated (Orchestrations) #449
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
Merged
sophiatev
merged 46 commits into
main
from
stevosyan/extended-sessions-for-orchestrations-isolated
Sep 17, 2025
Merged
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
2bb20bd
updated to use c# built in memory cache
afde88d
fixed bug where new events were not cleared
5001bb7
added a new field to the OrchestratorResponse, restored the old publi…
38d3a32
removed unused ExtendedSessions object
92bb2cd
fixing line endings
38a6011
Merge branch 'main' into stevosyan/extended-sessions-for-orchestratio…
c23f1f6
added comments to the ExtendedSessionState class and the memory cache…
d8b0332
fixing props line endings
2162650
Merge branch 'main' into stevosyan/extended-sessions-for-orchestratio…
044f780
added a wrapper ExtendedSessionsCache object
b5d8481
added comments
0def003
updated the expiration scan frequency
306dd39
addressing some comments
834711b
fixing indentation
3f24e5f
adding proto files
18f1cb7
Merge branch 'main' into stevosyan/extended-sessions-for-orchestratio…
206457d
added a max frequency to cache scan expiration
754948e
reverting to old implementation without a max
80165ea
addressing comments
eac9190
adding updated protos
298d911
added null check
2c21871
missed an earlier PR comment
e6860a9
added the durabletask packages from the test source
77794ac
updated reference to new preview package
8e1c6c1
pushing the updated yml
a5252de
forgot to update the release package name
3c40541
adding unit tests
1c38f81
had the wrong default timeout
5a762a3
fixed failing test
083a304
adding new dependencies and new package number
c0af286
pushing bug fix for not honoring a host restarting an extended session
527cf6d
updating version numbers
5972863
Merge branch 'main' into stevosyan/extended-sessions-for-orchestratio…
0604373
added proto changes from main branch
8e69683
downgrading the cache package to a version that is test with net6.0
547261e
reverting ci changes
44d654f
adding caching package
d11758c
addressing PR comments
bbe2d2d
missed one file
dcbf62b
had a mistake in the LoadAndRun path
9a573aa
slight update to extended session parameter name
6f8d8d8
Merge branch 'main' into stevosyan/extended-sessions-for-orchestratio…
6a0354a
slight change to avoid unnecessary initialization of the cache if pro…
11ab61d
slight change to make the idle timeout need to be >0 rather than >=0
f18a910
updating version numbers and protos
d5bcf8c
Merge branch 'main' into stevosyan/extended-sessions-for-orchestratio…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| # The following files were downloaded from branch main at 2025-09-10 22:50:45 UTC | ||
| https://raw.githubusercontent.com/microsoft/durabletask-protobuf/985035a0890575ae18be0eb2a3ac93c10824498a/protos/orchestrator_service.proto | ||
| # The following files were downloaded from branch main at 2025-09-17 01:45:58 UTC | ||
| https://raw.githubusercontent.com/microsoft/durabletask-protobuf/f5745e0d83f608d77871c1894d9260ceaae08967/protos/orchestrator_service.proto |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using DurableTask.Core; | ||
|
|
||
| namespace Microsoft.DurableTask.Worker; | ||
|
|
||
| /// <summary> | ||
| /// Represents the state of an extended session for an orchestration. | ||
| /// </summary> | ||
| public class ExtendedSessionState | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="ExtendedSessionState"/> class. | ||
| /// </summary> | ||
| /// <param name="state">The orchestration's runtime state.</param> | ||
| /// <param name="taskOrchestration">The TaskOrchestration implementation of the orchestration.</param> | ||
| /// <param name="orchestrationExecutor">The TaskOrchestrationExecutor for the orchestration.</param> | ||
| public ExtendedSessionState(OrchestrationRuntimeState state, TaskOrchestration taskOrchestration, TaskOrchestrationExecutor orchestrationExecutor) | ||
| { | ||
| this.RuntimeState = state; | ||
| this.TaskOrchestration = taskOrchestration; | ||
| this.OrchestrationExecutor = orchestrationExecutor; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the saved runtime state of the orchestration. | ||
| /// </summary> | ||
| public OrchestrationRuntimeState RuntimeState { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the saved TaskOrchestration implementation of the orchestration. | ||
| /// </summary> | ||
| public TaskOrchestration TaskOrchestration { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the saved TaskOrchestrationExecutor. | ||
| /// </summary> | ||
| public TaskOrchestrationExecutor OrchestrationExecutor { get; set; } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using Microsoft.Extensions.Caching.Memory; | ||
|
|
||
| namespace Microsoft.DurableTask.Worker; | ||
|
|
||
| /// <summary> | ||
| /// A cache for extended sessions that wraps a <see cref="MemoryCache"/> instance. | ||
| /// Responsible for holding <see cref="ExtendedSessionState"/> for orchestrations that are running within extended sessions. | ||
| /// </summary> | ||
| public class ExtendedSessionsCache : IDisposable | ||
| { | ||
| MemoryCache? extendedSessions; | ||
|
|
||
| /// <summary> | ||
| /// Gets a value indicating whether returns whether or not the cache has been initialized. | ||
| /// </summary> | ||
| /// <returns>True if the cache has been initialized, false otherwise.</returns> | ||
| public bool IsInitialized => this.extendedSessions is not null; | ||
|
|
||
| /// <summary> | ||
| /// Dispose the cache and release all resources. | ||
| /// </summary> | ||
| public void Dispose() | ||
| { | ||
| this.extendedSessions?.Dispose(); | ||
| GC.SuppressFinalize(this); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets the cache for extended sessions if it has already been initialized, or otherwise initializes it with the given expiration scan frequency. | ||
| /// </summary> | ||
| /// <param name="expirationScanFrequencyInSeconds"> | ||
| /// The expiration scan frequency of the cache, in seconds. | ||
| /// This specifies how often the cache checks for stale items, and evicts them. | ||
| /// </param> | ||
| /// <returns>The IMemoryCache that holds the cached <see cref="ExtendedSessionState"/>.</returns> | ||
| public MemoryCache GetOrInitializeCache(double expirationScanFrequencyInSeconds) | ||
| { | ||
| this.extendedSessions ??= new MemoryCache(new MemoryCacheOptions | ||
| { | ||
| ExpirationScanFrequency = TimeSpan.FromSeconds(expirationScanFrequencyInSeconds / 5), | ||
| }); | ||
|
|
||
| return this.extendedSessions; | ||
| } | ||
| } |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.