-
Notifications
You must be signed in to change notification settings - Fork 11
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
Implement Real-Time Functionality #61
Comments
14 tasks
Thinking something like this: # define use_stream (or similar) in the __init__ method on the client.
def connect(self)
while self.use_stream:
try:
stream = requests.GET(stream_url, stream=True)
except requests.ConnectionError:
reconnect() |
matthewelwell
pushed a commit
that referenced
this issue
Feb 6, 2024
* #61 SSE streaming manager * Remove extraneous import * isort fixes * Self CR * CR changes * Simplify Flagsmith.__init__ to keep flake8 happy * Remove extraneous noqa * Adds typing to new methods and tests * Remove typing.TypeAlias Incompatible with python <= 3.9 * Use Optional as opposed to pipe
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The Python client should support our real-time functionality via SSE. When using local evaluation mode, the client should listen for events on the stream and update its local cache of data if the value if the value of
updated_at
that was provided in the stream message is more recent than the last one received (and stored) from theX-Flagsmith-Document-Updated-At
header received from the relevant API endpoint.We should start by implementing this for local evaluation, since we already maintain a local cache of the environment document in this instance.
With regards to remote evaluation modes, we will need to implement a caching interface that stores the
Flags
class from the latest response from the relevant endpoint, and retrieves the flags again if it receives an event on the SSE stream. For now, this cache interface only needs to support a local memory cache, but we should make the interface generic to support other options.The text was updated successfully, but these errors were encountered: