-
Notifications
You must be signed in to change notification settings - Fork 154
Feature request: AppConfigProvider
to return the last valid value when the API returns empty value on subsequent calls
#1363
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
Comments
Started a fork to work on this, will PR as soon as I can! |
Looking at this closer (and trying a differing Notably, I only saw this behavior for the Specifically, if I issue multiple calls within the cache age, I get the expected results. If I issue a call after the maxAge is finished (e.g. > 5 seconds by default), but within the age of the AppConfig session, I get empty results. We may need additional caching logic inside the AppConfig provider to handle the empty After a new cold start, I get values again. |
More testing is showing that Subsequent calls are pulling the (empty) value from cache at the right time, and falling back to AppConfig at the right time. Investigating strategies for an internal secondary cache inside the Looks like they keep a local cache inside the Side note... I'm a little concerned they don't scope that by the |
I think the clobbering behavior you're observing is exacerbated by the fact that the cache is short lived, and so each call always overwrite the previous value no matter what. If we fix the cache behavior then it's up to users to tune the As I mentioned in the PR review, I'm happy to make this behavior more explicit in the docs but I don't think we should mask this with another cache layer that always returns data when AppConfig stays empty. This to me, is an anti pattern as customers might be relying on the previously known behavior from AppConfig and handling empty values as "config has not changed". If we start returning data at each call, we might cause them to unnecessarily refresh their app/service for no reason. |
maxAge
for parameters not converting to secondsAppConfigProvider
to return the last valid value when the API returns empty value on subsequent calls
After the discussion in the PR we have agreed to repurpose the issue to correct the clobbering behavior. I was wrong in my previous message and the expected behavior should be to store a valid value & return it instead. |
|
Use case
When retrieving a configuration profile from AppConfig, customers need to be mindful of the poll interval and to the fact that AppConfig returns empty responses for every subsequent call made after a successful retrieval and before the remote config has changed.
To provide a better DX, and to align with the implementation made in Powertools for Python, we should store the last valid configuration and return it instead of returning a response if users call the API again and the main cache was expired.
Solution/User Experience
Whenever a valid configuration profile is retrieve, store the value in the provider. Then, if the API is polled before the configuration has been refreshed (which would return an empty response), return the stored value instead of the empty response.
Alternative solutions
No response
Acknowledgment
Future readers
Please react with 👍 and your use case to help us understand customer demand.
The text was updated successfully, but these errors were encountered: