-
Notifications
You must be signed in to change notification settings - Fork 8
feat: adds init async with timeout and deprecated non-timeout init functions #95
feat: adds init async with timeout and deprecated non-timeout init functions #95
Conversation
… timeouts and functions taking in User instances.
@@ -349,7 +348,6 @@ public interface ILdClient : IDisposable | |||
/// about setting the context and optionally requesting a unique key for it</param> | |||
/// <returns>a task that yields true if new flag values were obtained</returns> | |||
/// <seealso cref="Identify(Context, TimeSpan)"/> | |||
/// <seealso cref="ILdClientExtensions.IdentifyAsync(ILdClient, User)"/> |
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.
For reviewers: User is deprecated
/// the LaunchDarkly service is returned, or immediately if offline, or when the the specified | ||
/// wait time elapses. If the max wait time elapses, the returned instance will have | ||
/// an <see cref="Initialized"/> property of <see langword="false"/>, but the instance will continue | ||
/// trying to get fresh feature flags. |
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.
For reviewers: Documentation changes are just tidying up the contents and making each of the init docs more consistent with each other. They diverged in subtle ways over time.
/// <returns>a Task that resolves to the singleton LdClient instance</returns> | ||
[Obsolete("Initializing the LDClient without a timeout is no longer permitted to help prevent" + | ||
"consumers from blocking their application execution by mistake when connectivity is poor. Please" + | ||
"use InitAsync(string, ConfigurationBuilder.AutoEnvAttributes, Context, TimeSpan) and specify a max wait time.")] |
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.
For reviewers: The diff engine makes this look like I added a method and deprecated it immediately. That is not the case, just the diff shifting things around.
} | ||
|
||
var startTask = _connectionManager.Start(); | ||
var completedTask = await Task.WhenAny(startTask, Task.Delay(maxWaitTime)); |
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.
How does this !=
logic work? (just haven't seen it before with tasks)
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.
The whenAny returns the task that completed and if it isn't the start task then it must be the delay task.
🤖 I have created a release *beep* *boop* --- ## [5.2.0](5.1.0...5.2.0) (2024-05-08) ### Features * adds init async with timeout and deprecated non-timeout init functions ([#95](#95)) ([41e70f2](41e70f2)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Requirements
Related issues
242110