cmd/stepd: Don't copy lock value

This commit is contained in:
Sasha Koshka 2025-07-07 07:53:01 -04:00
parent 64fb80734d
commit 48e8c2d4f0

View File

@ -209,8 +209,10 @@ func main () {
// set up the HTTP server
httpServer := httpServerRoutine {
Addr: config.Get("http.address"),
Handler: &handler,
Server: &http.Server {
Addr: config.Get("http.address"),
Handler: &handler,
},
}
// set up the trimming routine
@ -241,21 +243,22 @@ func main () {
}
}
type httpServerRoutine http.Server
type httpServerRoutine struct {
*http.Server
}
func (this *httpServerRoutine) Run (ctx context.Context) error {
ctx, done := context.WithCancel(ctx)
defer done()
server := http.Server(*this)
go func () {
<- ctx.Done()
shutdownCtx, done := context.WithTimeout (
context.Background(),
16 * time.Second)
defer done()
server.Shutdown(shutdownCtx)
this.Server.Shutdown(shutdownCtx)
} ()
err := server.ListenAndServe()
err := this.Server.ListenAndServe()
if ctx.Err() != nil {
return ctx.Err()
}