Skip to content

Commit

Permalink
Rename NewCancelRunnable to RunnableWithCancel
Browse files Browse the repository at this point in the history
Co-authored-by: Vince Prignano <vince@prigna.com>
  • Loading branch information
inteon and vincepri committed Feb 14, 2023
1 parent bffdb89 commit a169245
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/internal/controller/controller_test.go
Expand Up @@ -346,9 +346,9 @@ var _ = Describe("controller", func() {
Expect(err.Error()).To(Equal("can not restart a stopped controller, you should create a new one"))
})

It("should be possible to cancel the controller using NewCancelRunnable", func() {
It("should be possible to cancel the controller using RunnableWithCancel", func() {
stoppedChan := make(chan struct{})
cancellableController, cancel := manager.NewCancelRunnable(ctrl)
cancellableController, cancel := manager.RunnableWithCancel(ctrl)

go func() {
defer close(stoppedChan)
Expand Down
4 changes: 2 additions & 2 deletions pkg/manager/manager.go
Expand Up @@ -342,8 +342,8 @@ type LeaderElectionRunnable interface {
NeedLeaderElection() bool
}

// NewCancelRunnable returns a new Runnable and a function to cancel that runnable.
func NewCancelRunnable(r Runnable) (Runnable, context.CancelFunc) {
// RunnableWithCancel returns a new Runnable and a function to cancel that runnable.
func RunnableWithCancel(r Runnable) (Runnable, context.CancelFunc) {
mu := sync.Mutex{}
var cancels []func()
canceled := false
Expand Down

0 comments on commit a169245

Please sign in to comment.