-
Notifications
You must be signed in to change notification settings - Fork 492
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
Utilize retry policy when retrying to send SAS token in CBS auth in AMQP #3074
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
6e6c1c5
Update implementation for amqp token refresher
schoims 6bb4d8c
Refactor
schoims 89acbe0
Add test
schoims 7cd6b08
Edit a test case
schoims 5d57df8
Revert
schoims 05ab518
Dispose token
schoims 21a63f7
small update
schoims fa3ef04
Make update
schoims c68fec4
Edit code
schoims 9144246
Update test cases
schoims 265c0dc
Rename test cases
schoims 863994b
Edit ErrorDelegatingHandler
schoims 5ebe6f2
Address comments
schoims 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 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 |
---|---|---|
|
@@ -62,9 +62,10 @@ internal IotHubBaseClient( | |
DesiredPropertyUpdateCallback = OnDesiredStatePatchReceived, | ||
ConnectionStatusChangeHandler = OnConnectionStatusChanged, | ||
MessageEventCallback = OnMessageReceivedAsync, | ||
RetryPolicy = _clientOptions.RetryPolicy ?? new IotHubClientNoRetry(), | ||
}; | ||
|
||
InnerHandler = pipelineBuilder.Build(PipelineContext, _clientOptions.RetryPolicy); | ||
InnerHandler = pipelineBuilder.Build(PipelineContext); | ||
|
||
if (Logging.IsEnabled) | ||
Logging.Exit(this, _clientOptions.TransportSettings, nameof(IotHubBaseClient) + "_ctor"); | ||
|
@@ -116,6 +117,10 @@ public async Task OpenAsync(CancellationToken cancellationToken = default) | |
cancellationToken.ThrowIfCancellationRequested(); | ||
|
||
await InnerHandler.OpenAsync(cancellationToken).ConfigureAwait(false); | ||
if (_clientOptions.TransportSettings is IotHubClientAmqpSettings) | ||
{ | ||
InnerHandler.SetSasTokenRefreshesOn(); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sets SAS token refreshes on only for AMQP |
||
} | ||
|
||
/// <summary> | ||
|
@@ -403,6 +408,11 @@ public async Task CloseAsync(CancellationToken cancellationToken = default) | |
cancellationToken.ThrowIfCancellationRequested(); | ||
|
||
await InnerHandler.CloseAsync(cancellationToken).ConfigureAwait(false); | ||
|
||
if (_clientOptions.TransportSettings is IotHubClientAmqpSettings) | ||
{ | ||
await InnerHandler.StopSasTokenLoopAsync().ConfigureAwait(false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Stop SAS token refresh loop only for AMQP |
||
} | ||
} | ||
|
||
/// <inheritdoc/> | ||
|
This file contains 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 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 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 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 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 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.
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.
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.
Set RetryPolicy with the default exponential backoff policy unless user set it to null which is IotHubClientNoRetry()