Giter Club home page Giter Club logo

Comments (6)

daveleek avatar daveleek commented on July 4, 2024 2

Thank you for raising this @rafaelpadovezi, we'll have a look and get back to you!

from unleash-client-dotnet.

daveleek avatar daveleek commented on July 4, 2024 1

thank you @rafaelpadovezi - yes cleaning up should definitely be taken care of!
I'll have a look at fixing that!

from unleash-client-dotnet.

daveleek avatar daveleek commented on July 4, 2024 1

I'm closing this issue now @rafaelpadovezi. But feel free to reopen or create a new issue if you have further questions!

from unleash-client-dotnet.

daveleek avatar daveleek commented on July 4, 2024

Hi again @rafaelpadovezi. We've had a look and compared it with other SDKs and how it is intended to work.
Synchronous initialization is a blocking operation and should either block execution until features have been fetched and initialized, block until the request times out and then crash, or crash because the server is unavailable/server errors etc.

So it's intended behavior. Catching HttpRequestException was done to implement Error events however, and will be amended to work as intended in the synchronous initialization operation (it should crash).

Setting synchronous initialization to false should allow the behavior I think you are asking for - it will schedule a fetch but initialize the Unleash client and make that immediately available. Feature evaluations will resolve to false until features have been fetched and properly initialized. To address/work with this there are a few options:

Local backups

Unleash will update a local backup every time it has fetched an updated set of features. This backup is attempted loaded during initialization of Unleash.

Bootstrapping

You can bootstrap Unleash with a custom set of features during startup by providing a file

Handling the update event

Unleash will raise a TogglesUpdatedEvent in the SDK every time it has updated its feature collection. You could subscribe to this event and trigger internal processes the first time this event is raised

from unleash-client-dotnet.

rafaelpadovezi avatar rafaelpadovezi commented on July 4, 2024

Thanks for the reply @daveleek.

We've had a look and compared it with other SDKs and how it is intended to work.

I used the python SDK also and it's behavior is to handle any exceptions. I was hoping dotnet SDK worked the same way.

So it's intended behavior. Catching HttpRequestException was done to implement Error events however, and will be amended to work as intended in the synchronous initialization operation (it should crash).

Ok, makes sense! One thing that I would like you to consider it's to make it easier if I want to initialize synchoronously by default and asynchoronously if got some error.

I had to do the following to acomplish that:

try
{
    Unleash = unleashFactory.CreateClient(settings, synchronousInitialization: true);
}
 catch (Exception ex)
{
    settings.ScheduledTaskManager.Dispose();
    Unleash = unleashFactory.CreateClient(settings, synchronousInitialization: false);
}

One suggestion is to dispose everything created by the factory if CreateClient fails.

from unleash-client-dotnet.

daveleek avatar daveleek commented on July 4, 2024

Ok @rafaelpadovezi - I've had a look at it, and have discussed this with the team. Addressing this properly will require a re-architecture of the SDK and how it handles scheduling, and realigning with how we want our SDKs to work. It looks like you have a workaround that resolves the issue you've been experiencing, and we have other priorities ahead of this, so it's not going to be addressed right now.

from unleash-client-dotnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.