Skip to content
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

docs: document setProviderAndWait in README #610

Merged
merged 5 commits into from
Sep 14, 2023

Conversation

code4Y
Copy link
Contributor

@code4Y code4Y commented Sep 13, 2023

This PR

  • Updated the setProviderAndWait example in the quick start section
  • Expand the provider's section to show both the async and synchronous options.

Related Issues

Update readme examples to include setProviderAndWait

Fixes #592

Notes

If there are any corrections, please let me know.

- Updated the setProviderAndWait example in the quick start section
- Expand the provider's section to show both the async and synchronous options.

Signed-off-by: Yash <[email protected]>
@code4Y code4Y requested a review from a team as a code owner September 13, 2023 10:21
README.md Outdated Show resolved Hide resolved
README.md Outdated
Comment on lines 230 to 255
#### Asynchronous Named Provider Configuration

To register providers asynchronously, ensuring they are initialized before further actions are taken, you can use the `setProviderAndWait` method as shown below:

```java
FeatureProvider scopedProvider = new MyProvider();

// registering the default provider
// registering the default provider asynchronously
OpenFeatureAPI.getInstance().setProviderAndWait(LocalProvider());
// registering a named provider asynchronously
OpenFeatureAPI.getInstance().setProviderAndWait("clientForCache", new CachedProvider());

// a client backed by the default provider
Client clientDefault = OpenFeatureAPI.getInstance().getClient();
// a client backed by CachedProvider
Client clientNamed = OpenFeatureAPI.getInstance().getClient("clientForCache");
```

#### Synchronous Named Provider Configuration

For synchronous provider registration, where you set the provider without waiting for initialization, you can use the `setProvider` method directly, as shown in the following example:

```java
FeatureProvider scopedProvider = new MyProvider();

// registering the default provider synchronously
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need to repeat yourself here. Just mention that named providers can be set in a blocking/non-blocking way, and then link to the previous doc you wrote above.

@toddbaert toddbaert self-requested a review September 13, 2023 12:49
Copy link
Member

@toddbaert toddbaert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @code4Y , this is a great start!

I left a few comments.

Also note, we use PR titles for semantic commit messages - so I've made a change to the title (this will be the commit message when we merge).

@toddbaert toddbaert changed the title Update setProviderAndWait in README.md doc: setProviderAndWait in README.md Sep 13, 2023
@toddbaert toddbaert changed the title doc: setProviderAndWait in README.md chore: document setProviderAndWait in README Sep 13, 2023
@toddbaert toddbaert changed the title chore: document setProviderAndWait in README docs: document setProviderAndWait in README Sep 13, 2023
- blocking / non-blocking terms added in Providers section
- removed repetition of  code and added link in Named clients 

Signed-off-by: Yash <[email protected]>
@code4Y
Copy link
Contributor Author

code4Y commented Sep 13, 2023

Hey @toddbaert, thank you for your guidance!

I've made the requested changes. Please take a look at them and let me know if there's anything else I need to improve.

Copy link
Member

@toddbaert toddbaert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@toddbaert
Copy link
Member

@code4Y you can disregard the CI failure. It's not related to your change.

@sonarcloud
Copy link

sonarcloud bot commented Sep 14, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@codecov
Copy link

codecov bot commented Sep 14, 2023

Codecov Report

Merging #610 (78534c6) into main (bdddeb1) will increase coverage by 0.35%.
The diff coverage is n/a.

@@             Coverage Diff              @@
##               main     #610      +/-   ##
============================================
+ Coverage     94.45%   94.81%   +0.35%     
- Complexity      360      362       +2     
============================================
  Files            32       32              
  Lines           848      848              
  Branches         52       52              
============================================
+ Hits            801      804       +3     
+ Misses           25       23       -2     
+ Partials         22       21       -1     
Flag Coverage Δ
unittests 94.81% <ø> (+0.35%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@toddbaert toddbaert merged commit 818131b into open-feature:main Sep 14, 2023
8 checks passed
@code4Y code4Y deleted the readme-include-setProviderAndWait branch September 23, 2023 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update readme examples to include setProviderAndWait
2 participants