Skip to content

Conversation

@aruiz14
Copy link
Contributor

@aruiz14 aruiz14 commented Nov 28, 2025

Issue: rancher/rancher#52873

The main goal of this PR is to minimize the time that CacheFactory.informersMutex is locked when Stop(gvk) is called.
For this, it leverages resetting and reusing guardedInformers, using its mutex for synchronization.
Also, the use of read locks for DoneWithCache unnecessarily prevented us from using a single mutex. Instead, I've replaced "resource locking" with reference counting, by using sync.WaitGroup.

@aruiz14 aruiz14 requested a review from a team as a code owner November 28, 2025 15:20
gi.cancel()

// Prevent other CacheFor calls for that GVK
gi.stopMutex.Lock()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also implicitly waited for all Cache users to finish, while it's now explicitly by using a WaitGroup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant