-
Notifications
You must be signed in to change notification settings - Fork 8
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: use separate bind for http ingress server #1615
Conversation
backend/controller/controller.go
Outdated
go func() { | ||
err := rpc.ServeHTTP(ctx, config.IngressBind, ingressHandler) | ||
if err != nil { | ||
logger.Errorf(err, "Ingress server failed") |
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.
Maybe we want to return an error here instead of logging? I wasn't 100% sure since I wanted to keep the current setup of returning the rpc.Serve
result.
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.
We definitely do want to return an error. Just put both into an errgroup an return eg.Wait()
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 really don't think we should be using an rpc.Server
for this, it has a whole lot of machinery that we just don't want for normal HTTP serving. Better to create a new package internal/http
(or similar).
00305f8
to
0ec9cea
Compare
backend/controller/controller.go
Outdated
go func() { | ||
err := rpc.ServeHTTP(ctx, config.IngressBind, ingressHandler) | ||
if err != nil { | ||
logger.Errorf(err, "Ingress server failed") |
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.
We definitely do want to return an error. Just put both into an errgroup an return eg.Wait()
internal/rpc/server.go
Outdated
BaseContext: func(net.Listener) context.Context { return ctx }, | ||
} | ||
|
||
return &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.
Can't you just return a http.Server
here?
backend/controller/controller.go
Outdated
go func() { | ||
err := rpc.ServeHTTP(ctx, config.IngressBind, ingressHandler) | ||
if err != nil { | ||
logger.Errorf(err, "Ingress server failed") |
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 really don't think we should be using an rpc.Server
for this, it has a whole lot of machinery that we just don't want for normal HTTP serving. Better to create a new package internal/http
(or similar).
0353016
to
c00648b
Compare
internal/http/server.go
Outdated
|
||
type Server struct { | ||
listen *url.URL | ||
Server *http.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.
We can probably embed this directly.
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.
DUUUUUUDE!!! Thank you. This is so much cleaner. Sorry it took me a bit to get there 😂
Noice |
c00648b
to
c7a4c6a
Compare
c7a4c6a
to
de6f0d7
Compare
Fixes #1609
@alecthomas I took a stab at this one. Lemme know if there's a better approach here. :)