-
Notifications
You must be signed in to change notification settings - Fork 769
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
Fix graceful shutdown if admin server is not enabled #4155
Fix graceful shutdown if admin server is not enabled #4155
Conversation
…-shutdown-without-admin-server
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love this simplification. Let me know your thoughts on my comment below
server/server.go
Outdated
@@ -27,6 +27,7 @@ func Listen(cfg *config.Configuration, handler http.Handler, adminHandler http.H | |||
stopAdmin := make(chan os.Signal) | |||
stopMain := make(chan os.Signal) | |||
stopPrometheus := make(chan os.Signal) | |||
var stopChannels = []chan<- os.Signal{stopMain} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: Maybe it's just me but I find append
more straightforward, can we modify to append(stopChannels, stopMain)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, can we use the :=
operand instead of var
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"append" is superfluous to just initialize the slice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
If admin server is not enabled
prebid-server/server/server.go
Lines 56 to 58 in 243c0f0
PBS cannot stop gracefully as it awaits on
stopAdmin
channel which is never triggeredprebid-server/server/server.go
Line 80 in 243c0f0