From b6fd8e1eb2c0ede17adc1c6a0e9cb17144f29558 Mon Sep 17 00:00:00 2001 From: Alexander Baryshnikov Date: Fri, 9 Oct 2020 19:38:18 +0800 Subject: [PATCH] inherit requests context from global - fixes termination --- server/runner/handler.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/runner/handler.go b/server/runner/handler.go index 12d4bbb..05abd18 100644 --- a/server/runner/handler.go +++ b/server/runner/handler.go @@ -99,6 +99,10 @@ func (cfg Config) Create(global context.Context) (*Server, error) { } ctx, cancel := context.WithCancel(global) router := gin.Default() + router.Use(func(gctx *gin.Context) { + gctx.Request = gctx.Request.WithContext(global) + gctx.Next() + }) cfg.installUI(router, units, workers) server.Attach(router.Group("/api/"), units, workers)