You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This fixes an issue where the clustersNamespaces and the userNamespaces
caches were not updated when Clusters were deleted.
This was most noticeable for clustersNamespaces since the GetAll there
would return everything in the cache, dated or not.
For the userNamespaces cache this was hidden, since the GetAll in this
case would receive an up to date list of the cached clusters and then
use that to look up individual keys, returning them in a collated list.
This meant it _looked like_ the cache was updated, but it was only
showing us what we wanted to see; the cache was still quietly building
up.
The solution here is to generate a Hash based on an ordered list of the
names of current clusters. When updating the clustersNamespaces cache, we
compare the saved with the current hash, and clear the clustersNamespaces if
they differ.
We also clear the userNamespaces at this point; since the userNamespaces
cache is dependent on both the clusters and the clustersNamespaces
cache, it is simpler to clear everything together.
The `userNsList` fun has been pulled apart for testing purposes, but is
otherwise the same. The testing that the userNamespaces cache has been
cleared was harder, since, as I said above the GetAll does not _really_
get all, but "gets all based on this cluster list". I can expose new
methods and change this into a genuine List if that is preferred, but
have not done that for now.
0 commit comments