-
Notifications
You must be signed in to change notification settings - Fork 0
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
Async support #28
Comments
Hi. We've had requests for this before, ever since async/await became a common pattern in .NET, and we're definitely considering it as part of a future rewrite. There are some reasons why that's not a straightforward change to make, but first, I'll clarify what the current behavior is:
Providing an async version of the constructor is probably feasible without major changes, but making flag evaluation async is a little more problematic. Because there are several points within the evaluation logic where another piece of data might need to be accessed on an as-needed basis (a prerequisite flag, or a user segment), there is no way to isolate the evaluation logic from the potential I/O operations ("potential" because, again, there's no actual I/O unless you're using a database). So the whole thing would need to be rewritten as async, and to support existing customers who are using it synchronously, we would need to wrap it in some "start a task and then block on the task" logic— which is a performance drag we'd prefer to avoid. There are various ways we could rearrange the code to address this, but some of them would require unsupporting some features that we currently support. As for "no blocking since it's designed for server-side operations"— this is the design that all of our server-side SDKs have always used, except for Node.js where all I/O is by definition asynchronous. The in-memory caching layer works as follows: if a flag has expired from the cache and has to be reread from the database, all requests for the flag are coalesced so that the flag is only read once no matter how many tasks are evaluating it. All subsequent requests for that flag go to the cache until the TTL expires again. |
Is your feature request related to a problem? Please describe.
Since there are connections that are being established, the SDK should support async operations. Currently the documentation says that the constructor can block up to 10 seconds. That doesn't sound like good design. For the other operations it is not clear how long the flag evaluation might block if at all. Since its not async I would assume no blocking since its designed for server side operations.
Describe the solution you'd like
All operations and methods that might be blocking due to network, file, etc calls should make async calls available.
Describe alternatives you've considered
Not much that can be done there except requests being blocked. They also cannot be cancelled when initiated.
The text was updated successfully, but these errors were encountered: