Skip to content

Commit fd76693

Browse files
Merge pull request rancher#35884 from ibuildthecloud/master
Don't block controller thread with deferred start
2 parents 39cecf0 + 14aed3f commit fd76693

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pkg/types/config/context.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,14 @@ type UserContext struct {
242242
}
243243

244244
func (w *UserContext) DeferredStart(ctx context.Context, register func(ctx context.Context) error) func() error {
245+
f := w.deferredStartAsync(ctx, register)
246+
return func() error {
247+
go f()
248+
return nil
249+
}
250+
}
251+
252+
func (w *UserContext) deferredStartAsync(ctx context.Context, register func(ctx context.Context) error) func() error {
245253
var (
246254
startLock sync.Mutex
247255
started = false

0 commit comments

Comments
 (0)