Skip to content

Commit

Permalink
Rename context's hcLock to lock
Browse files Browse the repository at this point in the history
  • Loading branch information
rramkumar1 committed Jul 25, 2018
1 parent b70b7a2 commit f003445
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pkg/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ type ControllerContext struct {
EndpointInformer cache.SharedIndexInformer

healthChecks map[string]func() error
hcLock sync.Mutex

lock sync.Mutex

// Map of namespace => record.EventRecorder.
recorders map[string]record.EventRecorder
Expand Down Expand Up @@ -141,8 +142,8 @@ func (ctx *ControllerContext) Recorder(ns string) record.EventRecorder {

// AddHealthCheck registers function to be called for healthchecking.
func (ctx *ControllerContext) AddHealthCheck(id string, hc func() error) {
ctx.hcLock.Lock()
defer ctx.hcLock.Unlock()
ctx.lock.Lock()
defer ctx.lock.Unlock()

ctx.healthChecks[id] = hc
}
Expand All @@ -152,8 +153,8 @@ type HealthCheckResults map[string]error

// HealthCheck runs all registered healthcheck functions.
func (ctx *ControllerContext) HealthCheck() HealthCheckResults {
ctx.hcLock.Lock()
defer ctx.hcLock.Unlock()
ctx.lock.Lock()
defer ctx.lock.Unlock()

healthChecks := make(map[string]error)
for component, f := range ctx.healthChecks {
Expand Down

0 comments on commit f003445

Please sign in to comment.