-
Notifications
You must be signed in to change notification settings - Fork 5
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: updates the server startup #45
Conversation
server/server.go
Outdated
proto.RegisterFinalityGadgetServer(grpcServer, s) | ||
|
||
var wg sync.WaitGroup | ||
wg.Add(1) | ||
ready := make(chan struct{}) |
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.
why replace WaitGroup to use channel?
also why is the channel name ready
?
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.
WaitGroup only signals goroutine started, not if server is ready to accept connections, "ready" is used b/c it is clear for the channel's purpose
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.
WaitGroup only signals goroutine started, not if server is ready to accept connections
but how does it work in the past? we have always been using wg
"ready" is used b/c it is clear for the channel's purpose
ask Cursor. it's not a good name
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.
how does it work in the past?
right, WaitGroup works in server setups, but my understanding is the key difference is channels can propagate info while WaitGroup can only signal completion
it's not a good name
yes, it is too generic, maybe listenerReady
is better name
Summary
This PR updates the server startup:
httpServer.ListenAndServe()
would block until shutdownRunUntilShutdown
Test Plan
tested with the updated op test manager codes:
the logs: