-
-
Notifications
You must be signed in to change notification settings - Fork 69
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
I implemented a hot restart on fasthttp, but it cannot be implemented on atreugo because I can't access net.listen of atreugo.server #39
Comments
Can I use server.ServerPtr() or server.RouterPtr() ? |
What do you mean with |
In order to achieve hot restart, I have to get ln, but getListener() in atreugo is private function |
You don't need access to If you need a listener with reuseport, you could set to The both options are valid. |
So, if you want to create your own listener, change this function with something like that: func startServer(ln net.Listener) *atreugo.Atreugo {
config := &atreugo.Config{
Name: "fast",
}
server := atreugo.New(config)
server.Path("GET", "/hello", handler)
//r.GET("/test", test)
//r.GET("/web", web)
go server.Serve(ln)
return server
} |
Reuseport can listen same port at the same time ! Then in principle, it is very simple to implement hot restart.
The old server will Gracefully exit, and new server will go on to work. |
Yep 😄 hehe |
Finally, I added this https://godoc.org/github.com/savsgio/atreugo#Atreugo.RedirectTrailingSlash. I will release a new version in a few days. PD: I don't add |
I know, Thanks for add RedirectTrailingSlash. |
Imitate the code for this page, I should implement a hot restart on fasthttp
when I :
the /test can be accessed
When I plan to use this code to atreugo, but find the net.listen of atreugo.server can't be use.
The text was updated successfully, but these errors were encountered: