Skip to content
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

enable_local_evaluation and AWS Lambda #67

Closed
AdrianB-sovo opened this issue Oct 26, 2023 · 3 comments
Closed

enable_local_evaluation and AWS Lambda #67

AdrianB-sovo opened this issue Oct 26, 2023 · 3 comments

Comments

@AdrianB-sovo
Copy link

When using enable_local_evaluation in a Lambda, it doesn't work as expected.

I think that the sleep() inside the polling thread run() method is paused when the Lambda finish executing a call.
So, if we put environment_refresh_interval_seconds=60 and we have a lambda executed every minute with a duration of 100 ms, I think – I didn't confirm – that the environment would only be refreshed after 600 minutes instead of the expected 1 minute...

Maybe the run() should be implemented using a timestamp comparison with datetime.now() instead of sleep()?

@dabeeeenster
Copy link
Contributor

Local evaluation mode isnt really designed for a platform like Lambda where you don't have control over threads and overall process lifecycle. I'm not sure we would ever plan to do this? Thoughts @matthewelwell ?

@AdrianB-sovo
Copy link
Author

After thinking about it, I'm not sure it would be good to have it for serverless platforms.
If the Lambda has only one virtual core, the busy wait could be problematic and it's the only way that I could think of to keep the advantage of the local evaluation mode, i.e., having the environment always ready without latency added by the calls to the API.
The only alternative would probably be to cache it, and take the cost of refreshing the cache at times.

Maybe the documentation could indicate that the local evaluation mode is not recommended for serverless?

@dabeeeenster
Copy link
Contributor

Agreed! PR here: Flagsmith/flagsmith#2895

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants