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

do not hold the lock after controller has started #178

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pkg/internal/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ func (c *Controller) Watch(src source.Source, evthdler handler.EventHandler, prc
// Start implements controller.Controller
func (c *Controller) Start(stop <-chan struct{}) error {
c.mu.Lock()
defer c.mu.Unlock()

// TODO(pwittrock): Reconsider HandleCrash
defer utilruntime.HandleCrash()
Expand All @@ -142,6 +141,7 @@ func (c *Controller) Start(stop <-chan struct{}) error {
// Leaving it here because that could happen in the future
err := fmt.Errorf("failed to wait for %s caches to sync", c.Name)
log.Error(err, "Could not wait for Cache to sync", "Controller", c.Name)
c.mu.Unlock()
return err
}

Expand All @@ -160,6 +160,7 @@ func (c *Controller) Start(stop <-chan struct{}) error {
}

c.Started = true
c.mu.Unlock()

<-stop
log.Info("Stopping workers", "Controller", c.Name)
Expand Down