Skip to content

Commit 8cf50ba

Browse files
Fixing cache for multiple configurations
1 parent 36afcf7 commit 8cf50ba

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

aws_lambda_powertools/utilities/parameters/appconfig.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def __init__(
9999
self.current_version = ""
100100

101101
self._next_token: Dict[str, str] = {} # nosec - token for get_latest_configuration executions
102-
self.last_returned_value = ""
102+
self.last_returned_value: Dict[str, str] = {}
103103

104104
def _get(self, name: str, **sdk_options) -> str:
105105
"""
@@ -126,10 +126,12 @@ def _get(self, name: str, **sdk_options) -> str:
126126
return_value = response["Configuration"].read()
127127
self._next_token[name] = response["NextPollConfigurationToken"]
128128

129+
# The return of get_latest_configuration can be null because this value is supposed to be cached
130+
# on the customer side. We created a dict with the last returned value for the specific configuration
129131
if return_value:
130-
self.last_returned_value = return_value
132+
self.last_returned_value[name] = return_value
131133

132-
return self.last_returned_value
134+
return self.last_returned_value[name]
133135

134136
def _get_multiple(self, path: str, **sdk_options) -> Dict[str, str]:
135137
"""

0 commit comments

Comments
 (0)