inherit requests context from global - fixes termination
This commit is contained in:
parent
6d3d90b0e2
commit
b6fd8e1eb2
@ -99,6 +99,10 @@ func (cfg Config) Create(global context.Context) (*Server, error) {
|
|||||||
}
|
}
|
||||||
ctx, cancel := context.WithCancel(global)
|
ctx, cancel := context.WithCancel(global)
|
||||||
router := gin.Default()
|
router := gin.Default()
|
||||||
|
router.Use(func(gctx *gin.Context) {
|
||||||
|
gctx.Request = gctx.Request.WithContext(global)
|
||||||
|
gctx.Next()
|
||||||
|
})
|
||||||
cfg.installUI(router, units, workers)
|
cfg.installUI(router, units, workers)
|
||||||
server.Attach(router.Group("/api/"), units, workers)
|
server.Attach(router.Group("/api/"), units, workers)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user