Skip to content

Commit

Permalink
Add warning about the dangers of the blocking client methods
Browse files Browse the repository at this point in the history
  • Loading branch information
adams85 committed Nov 9, 2023
1 parent 2575f25 commit 420e0f0
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/ConfigCatClient/IConfigCatClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ public interface IConfigCatClient : IProvidesHooks, IDisposable
/// It is important to provide an argument for the <paramref name="defaultValue"/> parameter, specifically for the <typeparamref name="T"/> generic type parameter,
/// that matches the type of the feature flag or setting you are evaluating.<br/>
/// Please refer to <see href="https://configcat.com/docs/sdk-reference/dotnet/#setting-type-mapping">this table</see> for the corresponding types.
/// <para>
/// Please be aware that calling this method on a thread pool thread or the main UI thread is safe only when the client is set up to use Auto or Manual Polling and in-memory caching.
/// Otherwise execution may involve I/O-bound (e.g. network) operations. Thus, the executing thread may be blocked for a longer period of time, which can result in an unresponsive application.
/// In the case of problematic setups, it is recommended to use the async version of this method or snaphots (see <see cref="Snapshot"/>).
/// </para>
/// </remarks>
/// <typeparam name="T">
/// The type of the value. Only the following types are allowed:
Expand Down Expand Up @@ -69,6 +74,11 @@ public interface IConfigCatClient : IProvidesHooks, IDisposable
/// It is important to provide an argument for the <paramref name="defaultValue"/> parameter, specifically for the <typeparamref name="T"/> generic type parameter,
/// that matches the type of the feature flag or setting you are evaluating.<br/>
/// Please refer to <see href="https://configcat.com/docs/sdk-reference/dotnet/#setting-type-mapping">this table</see> for the corresponding types.
/// <para>
/// Please be aware that calling this method on a thread pool thread or the main UI thread is safe only when the client is set up to use Auto or Manual Polling and in-memory caching.
/// Otherwise execution may involve I/O-bound (e.g. network) operations. Thus, the executing thread may be blocked for a longer period of time, which can result in an unresponsive application.
/// In the case of problematic setups, it is recommended to use the async version of this method or snaphots (see <see cref="Snapshot"/>).
/// </para>
/// </remarks>
/// <typeparam name="T">
/// The type of the value. Only the following types are allowed:
Expand Down Expand Up @@ -111,6 +121,13 @@ public interface IConfigCatClient : IProvidesHooks, IDisposable
/// <summary>
/// Returns all setting keys synchronously.
/// </summary>
/// <remarks>
/// <para>
/// Please be aware that calling this method on a thread pool thread or the main UI thread is safe only when the client is set up to use Auto or Manual Polling and in-memory caching.
/// Otherwise execution may involve I/O-bound (e.g. network) operations. Thus, the executing thread may be blocked for a longer period of time, which can result in an unresponsive application.
/// In the case of problematic setups, it is recommended to use the async version of this method or snaphots (see <see cref="Snapshot"/>).
/// </para>
/// </remarks>
/// <returns>The collection of keys.</returns>
IReadOnlyCollection<string> GetAllKeys();

Expand All @@ -124,6 +141,13 @@ public interface IConfigCatClient : IProvidesHooks, IDisposable
/// <summary>
/// Returns the keys and values of all feature flags and settings synchronously.
/// </summary>
/// <remarks>
/// <para>
/// Please be aware that calling this method on a thread pool thread or the main UI thread is safe only when the client is set up to use Auto or Manual Polling and in-memory caching.
/// Otherwise execution may involve I/O-bound (e.g. network) operations. Thus, the executing thread may be blocked for a longer period of time, which can result in an unresponsive application.
/// In the case of problematic setups, it is recommended to use the async version of this method or snaphots (see <see cref="Snapshot"/>).
/// </para>
/// </remarks>
/// <param name="user">The User Object to use for evaluating targeting rules and percentage options.</param>
/// <returns>The dictionary containing the keys and values.</returns>
IReadOnlyDictionary<string, object?> GetAllValues(User? user = null);
Expand All @@ -139,6 +163,13 @@ public interface IConfigCatClient : IProvidesHooks, IDisposable
/// <summary>
/// Returns the values along with evaluation details of all feature flags and settings synchronously.
/// </summary>
/// <remarks>
/// <para>
/// Please be aware that calling this method on a thread pool thread or the main UI thread is safe only when the client is set up to use Auto or Manual Polling and in-memory caching.
/// Otherwise execution may involve I/O-bound (e.g. network) operations. Thus, the executing thread may be blocked for a longer period of time, which can result in an unresponsive application.
/// In the case of problematic setups, it is recommended to use the async version of this method or snaphots (see <see cref="Snapshot"/>).
/// </para>
/// </remarks>
/// <param name="user">The User Object to use for evaluating targeting rules and percentage options.</param>
/// <returns>The list of values along with evaluation details.</returns>
IReadOnlyList<EvaluationDetails> GetAllValueDetails(User? user = null);
Expand All @@ -154,6 +185,13 @@ public interface IConfigCatClient : IProvidesHooks, IDisposable
/// <summary>
/// Refreshes the locally cached config by fetching the latest version from the remote server synchronously.
/// </summary>
/// <remarks>
/// <para>
/// Please be aware that calling this method on a thread pool thread or the main UI thread is not safe because
/// execution involve I/O-bound (e.g. network) operations. Thus, the executing thread may be blocked for a longer period of time, which can result in an unresponsive application.
/// In the case of problematic setups, it is recommended to use the async version of this method.
/// </para>
/// </remarks>
/// <returns>The refresh result.</returns>
RefreshResult ForceRefresh();

Expand Down

0 comments on commit 420e0f0

Please sign in to comment.