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

Force controller & watcher goroutine to start "early" #1097

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions cmd/pipelines-as-code-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,15 @@ func main() {
log.Fatal("failed to init kinit client : ", err)
}

c := make(chan struct{})
go func() {
c <- struct{}{}
if err := run.WatchConfigMapChanges(ctx, run); err != nil {
log.Fatal(err)
}
}()
// Force WatchConfigMapChanges go routines to actually start
<-c

evadapter.MainWithContext(ctx, PACControllerLogKey, adapter.NewEnvConfig, adapter.New(run, kinteract))
}
4 changes: 4 additions & 0 deletions cmd/pipelines-as-code-watcher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ func main() {
w.WriteHeader(200)
_, _ = fmt.Fprint(w, "ok")
})

c := make(chan struct{})
go func() {
c <- struct{}{}
// start the web server on port and accept requests
log.Printf("Readiness and health check server listening on port %s", probesPort)
// timeout values same as default one from triggers eventlistener
Expand All @@ -38,6 +41,7 @@ func main() {
}
log.Fatal(srv.ListenAndServe())
}()
<-c

sharedmain.Main("pac-watcher", reconciler.NewController())
}