You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Switch for metadata refresh to be blocking (#3193)
* Adds the ability for the metadata refresh to be done as a blocking call, as per 8.0.1 behavior.
This is done through the Switch.Microsoft.IdentityModel.UpdateConfigAsBlocking switch.
If set, configuration calls will be blocking on update, and exceptions when requesting new metadata will be returned to the caller
---------
Co-authored-by: Keegan Caruso <[email protected]>
@@ -138,7 +138,7 @@ public ConfigurationManager(string metadataAddress, IConfigurationRetriever<T> c
138
138
/// <summary>
139
139
/// Obtains an updated version of Configuration.
140
140
/// </summary>
141
-
/// <returns>Configuration of type T.</returns>
141
+
/// <returns>Configuration of type <typeparamref name="T"/>.</returns>
142
142
/// <remarks>If the time since the last call is less than <see cref="BaseConfigurationManager.AutomaticRefreshInterval"/> then <see cref="IConfigurationRetriever{T}.GetConfigurationAsync"/> is not called and the current Configuration is returned.</remarks>
143
143
publicasyncTask<T>GetConfigurationAsync()
144
144
{
@@ -149,13 +149,40 @@ public async Task<T> GetConfigurationAsync()
/// <remarks>If the time since the last call is less than <see cref="BaseConfigurationManager.AutomaticRefreshInterval"/> then <see cref="IConfigurationRetriever{T}.GetConfigurationAsync"/> is not called and the current Configuration is returned.</remarks>
152
+
/// <returns>Configuration of type <typeparamref name="T"/>.</returns>
153
+
/// <remarks>
154
+
/// <para>
155
+
/// If the time since the last call is less than <see cref="BaseConfigurationManager.AutomaticRefreshInterval"/>
156
+
/// then <see cref="IConfigurationRetriever{T}.GetConfigurationAsync"/> is not called and the current Configuration is returned.
157
+
/// By default, this method blocks until the configuration is retrieved the first time. After the configuration was retrieved once,
158
+
/// updates will happen in the background. Failures to retrieve the configuration on the background thread will be logged.
159
+
/// </para>
160
+
/// <para>
161
+
/// If this operation is configured to be blocking through the switch 'Switch.Microsoft.IdentityModel.UpdateConfigAsBlocking'
162
+
/// then this method will block each time the configuration needs to be updated or hasn't been retrieved. If the configuration
163
+
/// cannot be initially retrieved an exception will be thrown. If the configuration has been retrieved, but cannot be updated,
164
+
/// then the exception will be logged and the current configuration will be returned.
165
+
/// </para>
166
+
/// <para>
167
+
/// By using the app context switch you choose what works best for you when there is a signing key update:
168
+
/// either block requests from being validated until the new key is retrieved, or allow requests to be validated
169
+
/// with the current key until the new key is retrieved. If blocking, a service receiving high concurrent request
#pragma warning restore CA1031// Do not catch general exception types
319
346
}
320
347
321
348
privatevoidUpdateConfiguration(Tconfiguration)
@@ -343,7 +370,20 @@ public override async Task<BaseConfiguration> GetBaseConfigurationAsync(Cancella
343
370
/// <para>2. The time between when this method was called and DateTimeOffset.Now is greater than <see cref="BaseConfigurationManager.RefreshInterval"/>.</para>
344
371
/// <para>If <see cref="BaseConfigurationManager.RefreshInterval"/> == <see cref="TimeSpan.MaxValue"/> then this method does nothing.</para>
345
372
/// </summary>
373
+
/// <remarks>
374
+
/// If the strategy is configured to be blocking through the switch 'Switch.Microsoft.IdentityModel.UpdateConfigAsBlocking',
375
+
/// then this method will not update the configuration, instead it will request the next call to <see cref="GetConfigurationAsync()"/>
/// Enabling this switch will cause the configuration manager to block other requests to GetConfigurationAsync if a request is already in progress.
75
+
/// The default configuration refresh behavior is if a request is already in progress, the current configuration will be returned until the ongoing request is completed on
0 commit comments