Skip to content

Commit 2d29ab5

Browse files
savitaashtureShivam Mukhade
authored andcommitted
Force watcher goroutine to start early
1 parent 600ab9e commit 2d29ab5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pkg/reconciler/controller.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,14 @@ func NewController() func(context.Context, configmap.Watcher) *controller.Impl {
3434
log.Fatal("failed to init kinit client : ", err)
3535
}
3636

37+
c := make(chan struct{})
3738
go func() {
39+
c <- struct{}{}
3840
if err := run.WatchConfigMapChanges(ctx, run); err != nil {
3941
log.Fatal(err)
4042
}
4143
}()
44+
<-c
4245

4346
pipelineRunInformer := pipelineruninformer.Get(ctx)
4447

@@ -47,7 +50,7 @@ func NewController() func(context.Context, configmap.Watcher) *controller.Impl {
4750
log.Fatalf("Failed to create pipeline as code metrics recorder %v", err)
4851
}
4952

50-
c := &Reconciler{
53+
r := &Reconciler{
5154
run: run,
5255
kinteract: kinteract,
5356
pipelineRunLister: pipelineRunInformer.Lister(),
@@ -56,9 +59,9 @@ func NewController() func(context.Context, configmap.Watcher) *controller.Impl {
5659
metrics: metrics,
5760
eventEmitter: events.NewEventEmitter(run.Clients.Kube, run.Clients.Log),
5861
}
59-
impl := pipelinerunreconciler.NewImpl(ctx, c, ctrlOpts())
62+
impl := pipelinerunreconciler.NewImpl(ctx, r, ctrlOpts())
6063

61-
if err := c.qm.InitQueues(ctx, run.Clients.Tekton, run.Clients.PipelineAsCode); err != nil {
64+
if err := r.qm.InitQueues(ctx, run.Clients.Tekton, run.Clients.PipelineAsCode); err != nil {
6265
log.Fatal("failed to init queues", err)
6366
}
6467

0 commit comments

Comments
 (0)