fix(metastore-cache): prune before add (#29301)

This commit is contained in:
Ville Brofeldt
2024-06-20 14:59:32 +03:00
committed by GitHub
parent 99fc04b9a6
commit 172ddb47d5
2 changed files with 16 additions and 3 deletions

View File

@@ -101,6 +101,7 @@ class SupersetMetastoreCache(BaseCache):
from superset.commands.key_value.create import CreateKeyValueCommand
try:
self._prune()
CreateKeyValueCommand(
resource=RESOURCE,
value=value,
@@ -108,7 +109,6 @@ class SupersetMetastoreCache(BaseCache):
key=self.get_key(key),
expires_on=self._get_expiry(timeout),
).run()
self._prune()
return True
except KeyValueCreateFailedError:
return False