mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-03 11:45:20 +00:00
fix: apply patch
Signed-off-by: Nolan Brubaker <brubakern@vmware.com> Signed-off-by: Ron Green <11993626+georgettica@users.noreply.github.com>
This commit is contained in:
@@ -29,25 +29,8 @@ import (
|
||||
// Runnable will turn a "regular" runnable component (such as a controller)
|
||||
// into a controller-runtime Runnable
|
||||
func Runnable(p controller.Interface, numWorkers int) manager.Runnable {
|
||||
f := func(stop <-chan struct{}) error {
|
||||
|
||||
// Create a cancel context for handling the stop signal.
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
// If a signal is received on the stop channel, cancel the
|
||||
// context. This will propagate the cancel into the p.Run
|
||||
// function below.
|
||||
go func() {
|
||||
select {
|
||||
case <-stop:
|
||||
cancel()
|
||||
case <-ctx.Done():
|
||||
}
|
||||
}()
|
||||
|
||||
// This is a blocking call that either completes
|
||||
// or is cancellable on receiving a stop signal.
|
||||
// Pass the provided Context down to the run function.
|
||||
f := func(ctx context.Context) error {
|
||||
return p.Run(ctx, numWorkers)
|
||||
}
|
||||
return manager.RunnableFunc(f)
|
||||
|
||||
@@ -859,7 +859,7 @@ func (s *server) runControllers(defaultVolumeSnapshotLocations map[string]string
|
||||
|
||||
s.logger.Info("Server starting...")
|
||||
|
||||
if err := s.mgr.Start(s.ctx.Done()); err != nil {
|
||||
if err := s.mgr.Start(s.ctx); err != nil {
|
||||
s.logger.Fatal("Problem starting manager", err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user