-
-
Notifications
You must be signed in to change notification settings - Fork 182
Description
Requirements
The openfeature python sdk supports both sync and async evaluation. However, the current goff Python provider only provides sync evaluation methods.
The issue is, with Python, due to the existence of the GIL, Python programs (at least unless you are using the GIL-less 3.14 version) are not truly multi-threaded. Thus, many modern Python web servers (FastAPI for example) suggest users to use async functions for better performance, which runs in a single-threaded event loop using coroutines for concurrency. This means that any synchronous code in an async handler would block the web server thread, which is bad, especially if the goff proxy server is down and the client ends up waiting for timeout. So the user would need to specifically spawn a thread to handle to avoid this blocking issue, which isn't pretty.
I think we should implement both sync and async methods in the python provider. Happy to create a PR when I got time if you think this is a good idea.