Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replaced and removed useless field in RemoteCache #16290

Merged
merged 1 commit into from
May 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 5 additions & 7 deletions pkg/allocator/allocator.go
Original file line number Diff line number Diff line change
Expand Up @@ -882,8 +882,7 @@ type AllocatorEvent struct {
// identities. The contents are not directly accessible but will be merged into
// the ForeachCache() function.
type RemoteCache struct {
cache cache
allocator *Allocator
cache cache
}

// WatchRemoteKVStore starts watching an allocator base prefix the kvstore
Expand All @@ -893,8 +892,7 @@ type RemoteCache struct {
// function.
func (a *Allocator) WatchRemoteKVStore(remoteAlloc *Allocator) *RemoteCache {
rc := &RemoteCache{
cache: newCache(remoteAlloc),
allocator: remoteAlloc,
cache: newCache(remoteAlloc),
}

a.remoteCachesMutex.Lock()
Expand All @@ -918,9 +916,9 @@ func (rc *RemoteCache) NumEntries() int {
// Close stops watching for identities in the kvstore associated with the
// remote cache and will clear the local cache.
func (rc *RemoteCache) Close() {
rc.allocator.remoteCachesMutex.Lock()
delete(rc.allocator.remoteCaches, rc)
rc.allocator.remoteCachesMutex.Unlock()
rc.cache.allocator.remoteCachesMutex.Lock()
delete(rc.cache.allocator.remoteCaches, rc)
rc.cache.allocator.remoteCachesMutex.Unlock()

rc.cache.stop()
}