mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-18 04:54:54 +00:00
scheduler: Changed upadteMetrics lock to RLock
This commit is contained in:
4
pkg/scheduler/backend/cache/cache.go
vendored
4
pkg/scheduler/backend/cache/cache.go
vendored
@@ -697,8 +697,8 @@ func (cache *cacheImpl) run() {
|
||||
|
||||
// updateMetrics updates cache size metric values for pods, assumed pods, and nodes
|
||||
func (cache *cacheImpl) updateMetrics() {
|
||||
cache.mu.Lock()
|
||||
defer cache.mu.Unlock()
|
||||
cache.mu.RLock()
|
||||
defer cache.mu.RUnlock()
|
||||
|
||||
metrics.CacheSize.WithLabelValues("assumed_pods").Set(float64(len(cache.assumedPods)))
|
||||
metrics.CacheSize.WithLabelValues("pods").Set(float64(len(cache.podStates)))
|
||||
|
||||
2
pkg/scheduler/backend/cache/interface.go
vendored
2
pkg/scheduler/backend/cache/interface.go
vendored
@@ -47,13 +47,11 @@ import (
|
||||
// +--------------------+ Deleted
|
||||
// Forget
|
||||
//
|
||||
//
|
||||
// Note that "Initial" and "Deleted" pods do not actually exist in cache.
|
||||
// Based on existing use cases, we are making the following assumptions:
|
||||
// - No pod would be assumed twice
|
||||
// - A pod could be added without going through scheduler. In this case, we will see Add but not Assume event.
|
||||
// - If a pod wasn't added, it wouldn't be removed or updated.
|
||||
|
||||
type Cache interface {
|
||||
// NodeCount returns the number of nodes in the cache.
|
||||
// DO NOT use outside of tests.
|
||||
|
||||
Reference in New Issue
Block a user