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

chore: add debug logs around shutdownCh #2210

Merged
merged 7 commits into from
May 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -1007,8 +1007,10 @@ func runSignalWrapper(cmd *Command) (err error) {
}
switch s {
case syscall.SIGINT:
cmd.logger.Debugf("Sending SIGINT signal for proxy to shutdown.")
shutdownCh <- errSigInt
case syscall.SIGTERM:
cmd.logger.Debugf("Sending SIGTERM signal for proxy to shutdown.")
if cmd.conf.ExitZeroOnSigterm {
shutdownCh <- errSigTermZero
} else {
Expand All @@ -1023,6 +1025,7 @@ func runSignalWrapper(cmd *Command) (err error) {
defer close(startCh)
p, err := proxy.NewClient(ctx, cmd.dialer, cmd.logger, cmd.conf)
if err != nil {
cmd.logger.Debugf("Error starting proxy: %v", err)
shutdownCh <- fmt.Errorf("unable to start: %v", err)
return
}
Expand Down Expand Up @@ -1131,7 +1134,11 @@ func runSignalWrapper(cmd *Command) (err error) {
)
}

go func() { shutdownCh <- p.Serve(ctx, notifyStarted) }()
go func() {
err := p.Serve(ctx, notifyStarted)
cmd.logger.Debugf("proxy server error: %v", err)
shutdownCh <- err
}()

err = <-shutdownCh
switch {
Expand Down
Loading