Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

feat: adds init async with timeout and deprecated non-timeout init functions #95

Merged
merged 4 commits into from
May 8, 2024

Conversation

tanderson-ld
Copy link
Contributor

@tanderson-ld tanderson-ld commented May 3, 2024

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Related issues

242110

@tanderson-ld tanderson-ld requested a review from a team May 3, 2024 14:13
@@ -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)"/>
Copy link
Contributor Author

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.
Copy link
Contributor Author

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.")]
Copy link
Contributor Author

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));
Copy link
Contributor

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)

Copy link
Contributor Author

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.

@tanderson-ld tanderson-ld merged commit 41e70f2 into main May 8, 2024
4 checks passed
@tanderson-ld tanderson-ld deleted the ta/sc-242110/deprecate-init-without-timeout branch May 8, 2024 16:59
tanderson-ld pushed a commit that referenced this pull request May 8, 2024
🤖 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>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants