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

feat(server): include callback for when the server is ready + fix bugs #50

Merged
merged 3 commits into from
Jan 11, 2022

Conversation

wsalles
Copy link
Contributor

@wsalles wsalles commented Jan 10, 2022

closes PLT-134

@wsalles wsalles self-assigned this Jan 10, 2022
Comment on lines 53 to 64

c := make(chan os.Signal, 3)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
<-c

s.logger.Infof("Shutdown Server ...")

if err := s.httpServer.Shutdown(ctx); err != nil {
s.logger.Fatal("Server forced to shutdown: ", err)
}

s.logger.Infof("Server exiting")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, that's a dead code because s.httpServer.ListenAndServe() blocks the execution.

pkg/common/server/server.go Outdated Show resolved Hide resolved
Copy link
Member

@portellaa portellaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the best way to know that the server is ready?

@wsalles
Copy link
Contributor Author

wsalles commented Jan 11, 2022

Is this the best way to know that the server is ready?

that's it or create requests to check if it's ready...
now, if there is a better way for this case, I don't know.

@wsalles wsalles requested a review from portellaa January 11, 2022 01:38
@renatoaguimaraes
Copy link
Contributor

Is this the best way to know that the server is ready?

that's it or create requests to check if it's ready... now, if there is a better way for this case, I don't know.

Maybe a GET operation on /readyz endpoint is better to know if the server is initialized. What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants