You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+69Lines changed: 69 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -316,6 +316,25 @@ async def some_endpoint():
316
316
return create_response()
317
317
```
318
318
319
+
### Asynchronous Feature Retrieval
320
+
321
+
The OpenFeature API supports asynchronous calls, enabling non-blocking feature evaluations for improved performance, especially useful in concurrent or latency-sensitive scenarios. If a provider *hasn't* implemented asynchronous calls, the client can still be used asynchronously, but calls will be blocking (synchronous).
322
+
323
+
```python
324
+
import asyncio
325
+
from openfeature import api
326
+
from openfeature.provider.in_memory_provider import InMemoryFlag, InMemoryProvider
flag_value =await client.get_boolean_value_async("v2_enabled", False) # API calls are suffixed by _async
332
+
333
+
print("Value: "+str(flag_value))
334
+
```
335
+
336
+
See the [develop a provider](#develop-a-provider) for how to support asynchronous functionality in providers.
337
+
319
338
### Shutdown
320
339
321
340
The OpenFeature API provides a shutdown function to perform a cleanup of all registered providers. This should only be called when your application is in the process of shutting down.
@@ -390,6 +409,56 @@ class MyProvider(AbstractProvider):
390
409
...
391
410
```
392
411
412
+
Providers can also be extended to support async functionality.
413
+
To support add asynchronous calls to a provider:
414
+
* Implement the `AbstractProvider` as shown above.
> Built a new provider? [Let us know](https://github.com/open-feature/openfeature.dev/issues/new?assignees=&labels=provider&projects=&template=document-provider.yaml&title=%5BProvider%5D%3A+) so we can add it to the docs!
0 commit comments