cmd/stepd: Don't copy lock value
This commit is contained in:
parent
64fb80734d
commit
48e8c2d4f0
@ -209,8 +209,10 @@ func main () {
|
|||||||
|
|
||||||
// set up the HTTP server
|
// set up the HTTP server
|
||||||
httpServer := httpServerRoutine {
|
httpServer := httpServerRoutine {
|
||||||
|
Server: &http.Server {
|
||||||
Addr: config.Get("http.address"),
|
Addr: config.Get("http.address"),
|
||||||
Handler: &handler,
|
Handler: &handler,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// set up the trimming routine
|
// 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 {
|
func (this *httpServerRoutine) Run (ctx context.Context) error {
|
||||||
ctx, done := context.WithCancel(ctx)
|
ctx, done := context.WithCancel(ctx)
|
||||||
defer done()
|
defer done()
|
||||||
server := http.Server(*this)
|
|
||||||
go func () {
|
go func () {
|
||||||
<- ctx.Done()
|
<- ctx.Done()
|
||||||
shutdownCtx, done := context.WithTimeout (
|
shutdownCtx, done := context.WithTimeout (
|
||||||
context.Background(),
|
context.Background(),
|
||||||
16 * time.Second)
|
16 * time.Second)
|
||||||
defer done()
|
defer done()
|
||||||
server.Shutdown(shutdownCtx)
|
this.Server.Shutdown(shutdownCtx)
|
||||||
} ()
|
} ()
|
||||||
err := server.ListenAndServe()
|
err := this.Server.ListenAndServe()
|
||||||
if ctx.Err() != nil {
|
if ctx.Err() != nil {
|
||||||
return ctx.Err()
|
return ctx.Err()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user