server: shutdown endpoint (#466)

fixes #390
This commit is contained in:
C Cirello
2016-12-29 20:19:42 +01:00
committed by GitHub
parent c2c2a0fb06
commit e3c85d3e7e
5 changed files with 42 additions and 3 deletions

10
main.go
View File

@@ -92,7 +92,15 @@ func main() {
})
svr.AddFunc(func(ctx context.Context) {
srv := server.New(ctx, ds, mq, rnr, tasks, server.DefaultEnqueue)
srv := server.New(
ctx,
ds,
mq,
rnr,
tasks,
server.DefaultEnqueue,
server.EnableShutdownEndpoint(halt),
)
srv.Run()
<-ctx.Done()
})