Repository navigation
Fix Durable client current-app detection #3528
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
Open
wangbill (YunchuWang)
wants to merge
10
commits into
dev
Choose a base branch
from
yunchuwang-fix-durable-client-current-app-detection
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
917a5e6
Fix durable client current-app detection
YunchuWang 7214b93
Merge branch 'dev' into yunchuwang-fix-durable-client-current-app-det…
YunchuWang f6bc0cf
Add Azure Storage current-app E2E coverage
YunchuWang 7ca55a1
Configure secondary Azurite in public E2E CI
YunchuWang 463fb96
Merge latest dev into current-app fix
YunchuWang c6d5767
Dispose Azure Storage service in E2E cleanup
YunchuWang 6af50cb
Use provider hub semantics for client selection
YunchuWang 8b7b18b
Preserve provider identity in durable client caches
YunchuWang b31f039
test: cover hosted durable client cache modes
YunchuWang 107e606
Merge branch 'dev' into yunchuwang-fix-durable-client-current-app-det…
YunchuWang 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
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
53 changes: 53 additions & 0 deletions
53
src/WebJobs.Extensions.DurableTask/DurableClientCacheKey.cs
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,53 @@ | ||
| // Copyright (c) .NET Foundation. All rights reserved. | ||
| // Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
|
||
| using System; | ||
|
|
||
| namespace Microsoft.Azure.WebJobs.Extensions.DurableTask | ||
| { | ||
| internal readonly struct DurableClientCacheKey : IEquatable<DurableClientCacheKey> | ||
| { | ||
| private readonly string taskHub; | ||
| private readonly string connectionName; | ||
| private readonly bool externalClient; | ||
| private readonly bool durableRequiresGrpc; | ||
|
|
||
| public DurableClientCacheKey(DurableClientAttribute attribute) | ||
| { | ||
| this.taskHub = attribute.TaskHub; | ||
| this.connectionName = attribute.ConnectionName; | ||
| this.externalClient = attribute.ExternalClient; | ||
| this.durableRequiresGrpc = attribute.DurableRequiresGrpc; | ||
| } | ||
|
|
||
| public bool Equals(DurableClientCacheKey other) | ||
| { | ||
| return string.Equals(this.taskHub, other.taskHub, StringComparison.Ordinal) | ||
| && string.Equals(this.connectionName, other.connectionName, StringComparison.Ordinal) | ||
| && this.externalClient == other.externalClient | ||
| && this.durableRequiresGrpc == other.durableRequiresGrpc; | ||
| } | ||
|
|
||
| public override bool Equals(object obj) | ||
| { | ||
| return obj is DurableClientCacheKey other && this.Equals(other); | ||
| } | ||
|
|
||
| public override int GetHashCode() | ||
| { | ||
| unchecked | ||
| { | ||
| int hashCode = 17; | ||
| hashCode = (hashCode * 31) + (this.taskHub == null | ||
| ? 0 | ||
| : StringComparer.Ordinal.GetHashCode(this.taskHub)); | ||
| hashCode = (hashCode * 31) + (this.connectionName == null | ||
| ? 0 | ||
| : StringComparer.Ordinal.GetHashCode(this.connectionName)); | ||
| hashCode = (hashCode * 31) + this.externalClient.GetHashCode(); | ||
| hashCode = (hashCode * 31) + this.durableRequiresGrpc.GetHashCode(); | ||
| return hashCode; | ||
| } | ||
| } | ||
| } | ||
| } |
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
14 changes: 14 additions & 0 deletions
14
test/FunctionsV2/FunctionApp/CurrentAppDetectionFunctions.cs
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,14 @@ | ||
| // Copyright (c) .NET Foundation. All rights reserved. | ||
| // Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
|
||
| namespace Microsoft.Azure.WebJobs.Extensions.DurableTask.Tests | ||
| { | ||
| internal static class CurrentAppDetectionFunctions | ||
| { | ||
| public static string TargetOnlyOrchestrator( | ||
| [OrchestrationTrigger] IDurableOrchestrationContext context) | ||
| { | ||
| return $"target:{context.GetInput<string>()}"; | ||
| } | ||
| } | ||
| } |
26 changes: 26 additions & 0 deletions
26
test/FunctionsV2/FunctionApp/HostedClientCacheFunctions.cs
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,26 @@ | ||
| // Copyright (c) .NET Foundation. All rights reserved. | ||
| // Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
|
||
| namespace Microsoft.Azure.WebJobs.Extensions.DurableTask.Tests | ||
| { | ||
| internal static class HostedClientCacheFunctions | ||
| { | ||
| [NoAutomaticTrigger] | ||
| public static void CaptureInternalClient( | ||
| string hub, | ||
| IDurableClient[] clients, | ||
| [DurableClient(TaskHub = "{hub}")] IDurableClient client) | ||
| { | ||
| clients[0] = client; | ||
| } | ||
|
|
||
| [NoAutomaticTrigger] | ||
| public static void CaptureExternalClient( | ||
| string hub, | ||
| IDurableClient[] clients, | ||
| [DurableClient(TaskHub = "{hub}", ExternalClient = true)] IDurableClient client) | ||
| { | ||
| clients[0] = client; | ||
| } | ||
| } | ||
| } |
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.