feat(surf): AssembleRouter builds the router and handler once; the router stops the MCP endpoint it mounted (quick-261118-lbt)
- surf.AssembleRouter returns the router and the compiled handler from one build, so an mcp.enabled app is not built twice; Assemble keeps its signature and is implemented on top of it - serve uses AssembleRouter with a deferred Router.Close - pier.Pier.Close stops the session reaper and the Redis warm-up; the router that mounted the endpoint owns it - ExampleAssembleRouter, routing/testing docs and the surf/pier READMEs
This commit is contained in:
@@ -86,15 +86,11 @@ clean stop and 1 when draining fails.`,
|
||||
}
|
||||
defer coolerHandle.Close()
|
||||
defer fallback.Close()
|
||||
r, err := BuildRouter(app, plugins)
|
||||
r, h, err := AssembleRouter(app, plugins)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer r.Close()
|
||||
h, err := r.compile()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
counter := newRequestCounter(h)
|
||||
ln, err := net.Listen("tcp", addr)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user