From f43b3956415c9ab3579383ac824ffdf5419036f4 Mon Sep 17 00:00:00 2001 From: Tony Meyer Date: Wed, 5 Jun 2024 17:30:09 +1200 Subject: [PATCH] Avoid unnecessary callout to the secret backend. --- ops/model.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ops/model.py b/ops/model.py index b7ab12c0f..37d586958 100644 --- a/ops/model.py +++ b/ops/model.py @@ -1436,9 +1436,8 @@ def set_content(self, content: Dict[str, str]): if self._id is None: self._id = self.get_info().id self._backend.secret_set(typing.cast(str, self.id), content=content) - # TODO: won't this just get the same content anyway? Unless we refresh - # (which ignores the cache) then the tracked revision won't be different. - self._content = None # invalidate cache so it's refetched next get_content() + # We do not need to invalidate the cache here, as the content is the + # same until `refresh` is used, at which point the cache is invalidated. def set_info( self,