-
Notifications
You must be signed in to change notification settings - Fork 420
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
App context switch to allow blocking or non-blocking GetConfiguration #3106
Merged
Conversation
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
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.
Copilot reviewed 5 out of 8 changed files in this pull request and generated no comments.
Files not reviewed (3)
- test/Microsoft.IdentityModel.Tokens.Tests/Telemetry/MockTelemetryClient.cs: Evaluated as low risk
- src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager.cs: Evaluated as low risk
- test/Microsoft.IdentityModel.Protocols.OpenIdConnect.Tests/ConfigurationManagerTelemetryTests.cs: Evaluated as low risk
Comments suppressed due to low confidence (1)
test/Microsoft.IdentityModel.TestUtils/ResetAppContextSwitchesAttribute.cs:11
- [nitpick] Consider renaming the class to 'ResetAppContextSwitches' for clarity and conciseness.
public class ResetAppContextSwitchesAttribute : BeforeAfterTestAttribute
GeoK
reviewed
Jan 30, 2025
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager_Blocking.cs
Show resolved
Hide resolved
GeoK
reviewed
Jan 30, 2025
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager.cs
Outdated
Show resolved
Hide resolved
GeoK
reviewed
Jan 30, 2025
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager.cs
Outdated
Show resolved
Hide resolved
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager_Blocking.cs
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager_Blocking.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager.cs
Outdated
Show resolved
Hide resolved
0b87a5f
to
2cb1b50
Compare
keegan-caruso
commented
Jan 31, 2025
2cb1b50
to
cda14f3
Compare
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
pmaytak
reviewed
Jan 31, 2025
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager.cs
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager.cs
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager.cs
Show resolved
Hide resolved
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
pmaytak
reviewed
Feb 6, 2025
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager.cs
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager.cs
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Tokens/Telemetry/ITelemetryClient.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Tokens/Telemetry/TelemetryClient.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Tokens/Telemetry/TelemetryClient.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Tokens/Telemetry/TelemetryDataRecorder.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Tokens/Telemetry/TelemetryDataRecorder.cs
Outdated
Show resolved
Hide resolved
- Tests need to be in a collection - Remove unneeded change
- Remove LastRefresh
2a51cfe
to
7e4ed4e
Compare
7e4ed4e
to
4458df8
Compare
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
GeoK
reviewed
Feb 6, 2025
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager_Blocking.cs
Show resolved
Hide resolved
GeoK
reviewed
Feb 6, 2025
.../Microsoft.IdentityModel.Protocols.OpenIdConnect.Tests/ConfigurationManagerTelemetryTests.cs
Show resolved
Hide resolved
GeoK
approved these changes
Feb 6, 2025
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
pmaytak
approved these changes
Feb 6, 2025
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
App context switch to allow blocking or non-blocking GetConfiguration
Stress testing showed that the current non-blocking implementation wasn't always triggered as expected, moving to an AutoResetEvent fixed this.
How Configuration is Updated Now:
Asynchronous Updates: The configuration can be updated asynchronously using background tasks. The method. The method to trigger the background task was updated to a AutoResetEvent.
Blocking vs Non-Blocking: The AppContextSwitches.UpdateConfigAsBlocking switch determines whether the configuration update should block other requests. If this switch is enabled, the method RequestRefreshBlocking is called; otherwise, RequestRefreshBackgroundThread is used.
Telemetry: The method TelemetryForUpdate handles logging the mode of update (manual or automatic) to a telemetry client.
These changes aim to improve the efficiency and responsiveness of the configuration update process by leveraging background tasks and signals.
Adds ShutdownBackgroundTask() method to ConfigurationManager to stop the background task.
Introduce ResetAppContextSwitches to have deterministic reset per test that uses an app context, this also serializes tests.
Adds
Fixes #3082